Matlab - Getting started

With this SDK you will be able to easily find and get data from your Tobii eye tracker. If you are new to eye tracking we recommend that you spend some time exploring the content in Tobii Pro's Learn & Support section of the Tobii Pro website . There you will find a lot of information about how eye tracking works in general and how to design studies.

In the Common concepts section of this website, you will find information about concept referenced in the SDK documentation which are common for all SDK languages. This includes, but are not limited to, things like the different coordinate systems used as well as how time stamps are defined.

Installing the Pro SDK

Visit our download site for the Pro SDK , and download the latest version of the Tobii Pro SDK Matlab Binding for your platform. The package includes all files you will need to develop an application that communicates with a Tobii Pro eye tracker. Extract the files and put them where you usually keep your development files.

Using the Pro SDK in your project

After extracting the files to the desired folder, use Matlab's command addpath(genpath('path')) in order to add the folder where the Pro SDK is located. Now you should be able to access the Pro SDK methods and classes from anywhere in the Matlab environment.

* Note: HMD eye trackers are currently not supported by Eye Tracker Manager.

A quick guide to a functional application

Most eye tracking applications follow the same pattern in terms of in which order functionality is used. The order is usually as follows:

  1. Browsing for eye trackers or selecting an eye tracker with known address.
  2. Establishing a connection with the eye tracker.
  3. Running a calibration procedure in which the eye tracker is calibrated to the user.
  4. Setting up a subscription to gaze data, and collecting and saving the data on the computer running the application. In some cases, the data is also shown live by the application.

To do this with the Pro SDK is very simple:

Step 1: Browsing

Start with creating an EyeTrackingOperations object and use either the find_all_eyetrackers function to get a list of available eye trackers or the get_eyetracker function that returns one eye tracker. The last function requires an URI to the eye tracker.

Step 2: Connecting to an eye tracker

The objects returned from these functions are instances of EyeTracker objects that you can easily interact with.

Step 3: Performing a calibration

To calibrate the eye tracker, use either a ScreenBasedCalibration, or a HMDBasedCalibration object (depending on the type of eye tracker). The ScreenBasedCalibration / HMDBasedCalibration class requires an EyeTracker object in the constructor. More information about how a calibration works can be found in the section Calibration.

Step 4: Subscribing to data

When you have the EyeTracker object and want to listen to gaze data, use either the function get_gaze_data or get_hmd_gaze_data (depending on the type of eye tracker) and the data will be returned as GazeData or HMDGazeData respectively.

On the Step-by-step page, there's a detailed description on how to perform these steps.

Using Pro SDK in Psychtoolbox

A quick and easy way to create an eye tracking study is by using Psychtoolbox. You can find a comprehensive guide in the form of a code example among the Matlab code examples in the SDK reference guide. Just look for "PsychToolBoxExample" under the Examples node.