Back to Eyelink Toolbox Q & A overview
How can I find out what a function of Eyelink does (in 10 easy steps)?
Since there's no Eyelinktoolbox manual (volunteer, anyone?), here's an example of how you can find out about the ins and outs of a function.
E.g. let's try to find out how to get a sample from the Eyelink.
1. Type help Eyelink at the matlab prompt. This tells you how to get more info. E.g by:
2. Typing Eyelink at the matlab prompt. This prints a list of all possible commands. In the list , you should now find one that may look useful, namely sample = Eyelink('NewestFloatSample').
3. At 1. you could also have found out that typing Eyelink('NewestFloatSample?') (so a particular command followed by a question mark) gives you further info on that particular command.
4. This gives you:
Usage: sample = Eyelink('NewestFloatSample')
Makes copy of most recent float sample received. returns -1 if no new sample or error.
Whether this suffices may depend on what you need to know. How to find out more about this function?
5. First, run one of the demos that uses this function (of course you ran them all, and studied them in detail, before you begin programming your own experiment ;-), e.g. EyelinkExample.m in the EyelinkDemos directory.
Removing the ; (semi-colon) from the line of code will matlab spit out whatever is returned by a function or calculation. So, removing the semi-colon from evt = Eyelink('NewestFloatSample') will slow down the demo, and give you a command window full of evt structure contents (or -1 if something was wrong).
(since i don't have an eyelink nearby, I can't copy the printout in, sorry)
But there is more:
5. The names of nearly all Eyelink commands closely follow the nomenclature of the underlying eyelink library functions. So, you could dive into the Eyelink Core API manual which was put somewhere on your harddisk by your Eyelink library-installer. In it is a section on the function:
eyelink_newest_float_sample() (spot the analogy ;-)?
There is some further explanation of the function:
Check if a new sample has arrived from the link. This is the latest sample, not the oldest sample
(there is more....)
It also lists the c declaration and some further info:
Routine Required Header
eyelink_newest_float_sample <eyelink.h>
INT16 eyelink_newest_float_sample(void FARTYPE *buf);
You need to check the example listed there to find out more, namely that buf is a pointer
to a data structure
ALLF_DATA evt;
To find out more about this structure and function, you can dive into eyelink.h (which holds the function declaration; this file should be found near where the core libraries are stored), but you won't find anything new there. The info on what ALLF_DATA contains can be found in eye_data.h (this file should also be found near where the core libraries are stored).
typedef union {
FEVENT fe;
IMESSAGE im;
IOEVENT io;
FSAMPLE fs;
} ALLF_DATA ;IMESSAGE im;
IOEVENT io;
FSAMPLE fs;
you actually need to dive deeper, to find out what each of these contain.
But now I am stumbling upon something curious, namely that we declare evt as an FSAMPLE rather than an ALLF_DATA. Still this appears to work (and I am sure this is how it had to be done several years ago, perhaps some check is done on the type of structure (size?) to determine what to return). This will be clarified soon, I hope. You could find out by downloading the PsychToolbox source code, and diving into EyelinkNewestFloatSample.c .
Anyway, FSAMPLE (what we use) is declared as:
typedef struct {
UINT32 time; INT16 type; UINT16 flags; float px[2], py[2]; float hx[2], hy[2]; float pa[2]; float gx[2], gy[2]; float rx, ry; UINT16 status; UINT16 input; UINT16 buttons; INT16 htype; INT16 hdata[8]; } FSAMPLE;
So, this shows all the names of the fields of the evt structure. The structure spit out by Eyelink('NewestFloatSample') uses exactly these named fields, and so there meaning is also identical.
This is about how far you can dig. What else to do?
6. Post message on forum at eyelinkinfo.com (for such detailed questions on the deeper meaning of Eyelink functions and data structures this is probably a more appropriate place than the PsychToolbox forum.
7. Come to Groningen, to the Laboratory of Experimental Ophthalmology, and we may be able to help you out.
8. Send us a large sum of cash, and we may write you a proper manual (or your experiment, for that matter ;-)
9. Meet us at ECVP.
10. Invite one of us over (all expenses paid of course ;-).