A functionally sequenced scanpath similarity method for comparing and evaluating scanpath similarity based on a task's inherent sequence of functional (action) units

FuncSim Toolbox for Matlab

On this page you will find the Matlab code of our functionally sequenced scanpath similarity method that compares and evaluates scanpath similarity according to a task's inherent sequence of functional units. FuncSim reveals whether gaze characteristics are similar in the same functional units of a task, opposed to when participants are engaged in different functional units of the task. In addition, it calculates a random baseline, i.e. similarity of one of the observed scanpaths to its scrambled derivative.

The toolbox should work with any version of Matlab since version 2010b and runs without any other toolboxes installed. However, it has only been tested under Windows.


Download the FuncSim toolbox. Unzip the files and set them to your Matlab path.

Open Matlab. Open example data by typing in the Command Window:

load FuncSimExampleData.mat

This file contains four variables each containing one example scanpath. You will see the four variables (path1, path2, path3, path4) in the Workspace. Double click on one of these paths to open it in the Variable Editor. Each path you want to compare with FuncSim has to have the same format as the example paths. Each row contains one fixation. The first column indicates to which functional unit the fixation belongs. The second and third columns contain the fixation?s x-and y-coordinates, respectively. The forth column contains the fixation duration.

Define the alignment method FuncSim shall use by typing in the Command Window:




The method 'average' will average each scanpath dimension (location, duration, length, direction) within each functional unit before calculating similarity across paths. This method is adequate if each functional unit contains a small number of fixations. The method 'reldur' will align fixations across paths within functional units according to their proportion to the functional unit?s overall dwell time.

Perform the comparison by typing in the Command Window:


Between-path differences (BPD) between path1 and path2 and random baseline differences (RBD) between path1 and its scrambled derivative for each dimension (location, duration, length, direction) will be displayed in the Command Window, e.g.:

Method: 'reldur'
BPDloc: 3.7289
RBDloc: 7.1413
BPDdur: 138.3157
RBDdur: 117.9000
BPDlen: 4.4453
RBDlen: 5.6136
BPDdir: 40.5908
RBDdir: 61.9408

The results will also be stored to the variable ?diff? in the Workspace. In addition, the alignment matrix is stored to the variable dataDiff. dataDiff contains the aligned values of path1, path2, and the scrambled path1 as well as all calculated differences (BPDs and RBDs).

Instructions are summarized in FuncSim_Instructions.m!

Artificial examples

The toolbox also contains eight artificial scanpath pairs (FuncSimArtificialExamples.mat) with different characteristics that might cause problems with different scanpaths similarity methods.

Pair1 'Equal': Path1 & Path2_1.
The paths are exactly the same scanpaths.
Pair2 'Duration': Path1 & Path2_2.
Fixations of Path2_2 have half the duration of Path1_2.
Pair3 'Scaled': Path1 & Path2_3.
Path2_3 was generated by scaling x- and y-coordinates of Path1_3
by the factor 0.5
Pair4 'Unequal number of fixations': Path1 & Path2_4.
Path2_4 was generated by shifting Path1_4 30 pixels up and 50 pixels to
the left. Fixations within same sub-units are located within same grid regions
Pair5 'Spatial offset': Path1 & Path2_5.
Path2_5 was generated by shifting the red path 30 pixels up and 50 pixels to
the left. Fixations within same sub-actions are located in different grid
regions. All fixations are 20 pixels lower and 20 pixels more to the right
than in Pair4.
Pair6 'Grid problem': Path1_6 & Path2_6.
Path2_6 contains fewer fixations than Path1_6. Path2_6 is also shifted 30
pixels up and 50 pixels to the left.
Pair7 'Unit assignment': Path1_7 & Path2_7.
Fixations of Path2_7 are differently assigned to the functional units than the
fixations of Path1_7.
Pair8 'Random unit assignment': Path1_8 & Path2_8.
Fixation groups of both paths are randomly assigned to functional units

Citation and Contact

When publishing data analyzed with FuncSim or using the artificial scanpath pairs, cite:

Foerster, R. M., & Schneider, W. X. (2013). Functionally sequenced scanpath similarity method (FuncSim): Comparing and evaluating scanpath similarity based on a task's inherent sequence of functional (action) units. Journal of Eye Movement Research, 6(5):4, 1-22. (LINK)

as well as

Foerster, R. M., & Schneider, W. X. (2013). FuncSim Toolbox for Matlab. CITEC, Bielefeld University. doi:10.4119/unibi/citec.2013.7

In case of problems or questions contact Rebecca M. Foerster:


This work was supported by a grant of the Cluster of Excellence Cognitive Interaction Technology (CITEC) at Bielefeld University.

New and updated versions

You may find additional and updated information at