EyeLink gaze-contingent demo showing how to retrieve fast gaze samples online.
In each trial central crosshairs are shown until gaze is detected continuously within a central
square window for 500ms or until the space bar is pressed. An image is
then presented until the space bar is pressed to end the trial.


screenNumber is an optional parameter which can be used to pass a specific value to PsychImaging(‘OpenWindow’, …)
If screenNumber is not specified, or if isempty(screenNumber) then the default:
screenNumber = max(Screen(‘Screens’));
will be used.

The demo checks if a new sample is available online via the link.
This is equivalent to eyeLink_newest_float_sample() in C API.
See EyeLink Programmers Guide manual > Function Lists > Message and Command Sending/Receiving > Functions
It allows access to the following sample properties:

  time (sample time)  
  type (SAMPLE=200)  
  gx ([left gaze x, right gaze x])  
  gy ([left gaze y, right gaze y])  
  pa ([lef eye pupil size, right eye pupil size])  
  rx (x 'pixel per degree' value)  
  ry (y 'pixel per degree' value)  
  buttons (button state and changes)  
  hdata (contains a list of 8 fields. Only the first 4 values are important:  
        [uncalibrated target sticker x, uncalibrated target sticker y, target sticker distance in mm, target flags)  
Path   Retrieve current version from GitHub | View changelog