Load Tobii eyetracker TSV (export) data files
% 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
Cite As
Guillaume (2024). Load Tobii eyetracker TSV (export) data files (https://www.mathworks.com/matlabcentral/fileexchange/36807-load-tobii-eyetracker-tsv-export-data-files), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.