File Exchange

image thumbnail

Load Tobii eyetracker TSV (export) data files

version 1.1 (2.52 KB) by

This function load a TSV file generated by the Tobii Studio software.

1 Download


View License

% function dataFile = loadTobiiTSV(fileName, chosenColumns, nbHeaderLines, dataFormat)
% This fucntion load a TSV file generated by the Tobii Studio software. It
% is highly advised that the TSV file be generated with the default option "All data"
% in Tobii studio. However if the number of expected columns is not correct
% than this function will try to autodetect the format of each column (use
% to your own risk)
% IN:
% fileName: the full parth and name of the file to load
% chosenColumns: a cell array of strings containing the list of columns labels to
% keep in the data. Can be a string for a single column.
% If an empty array is given then no columns are extracted
% and only the header is returned in the output.
% The string 'All' indicates that all column should be
% taken (default: 'All')
% nbHeaderLines: the number of lines to skip before finding the columns
% with Tobii data. This include the line containing column
% titles. (default: 41)
% dataFormat: the format of the columns as in the texscan matlab
% function. (default: '%u%s%s%u%f ...')
% OUT:
% data: a structure containing the content of the tobii file. The structure
% has the following fields:
% - header [Hx?]: the H first lines of the file in text format (can include the list
% of the column headers as the last line)
% - colname {1xC}: a cell array of strings containing the column
% headers of the chosen columns
% - data {1xC}: a cell array containing the data of each column. Each
% cell contain a cell array (for strings) and a vector
% for other data formats of size (NbSamplesx1)
% Exemples:
% loadTobiiTSV('myfile.tsv')
% will load all the columns of the TSV file
% loadTobiiTSV('myfile.tsv', 'RecordingName')
% will load only the RecordingName column
% loadTobiiTSV('myfile.tsv', {'RecordingName' 'RecordingResolution'})
% will load both the RecordingName and RecordingResolution columns
% loadTobiiTSV('myfile.tsv', '')
% will only load the header of the file
% loadTobiiTSV('myfile.tsv', 'All', 1)
% will load all columns but will consider that the header of the file
% contains only one line (the one containing the column titles)
% loadTobiiTSV('myfile.tsv', 'All', 41, '%d%f')
% will load all columns, the default header but will search in the
% file for two columns only, the first containing integers, the
% second containing floats.
% Author: Guillaume Chanel
% Date: 22.05.2012
% Modified: 26.08.2012

Comments and Ratings (0)



Update 26/07/2012: automatic determination of columns types in the case some strange files are loaded...

MATLAB Release
MATLAB 7.12 (R2011a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video