The Optotrak Toolbox:
Control your Optotrak from within Matlab.

Volker Franz, University of Tübingen, Germany

The Optotrak Certus and the older Optotrak 3020 (Northern Digital Inc.) are widely used and highly accurate 3D motion and position measurement systems. Traditionally, they are controlled using an interface written in the C-programming language (the C-API you need to have purchased from Northern Digital Inc.). In 2004, I wrote a toolbox which allows to control the Optotrak from within Matlab. This has a number of advantages: (a) Matlab provides a flexible environment for high level mathematics, much more versatile than C. This is advantageous for the processing of the 3D data produced by the Optotrak. (b) There exist already a number of Matlab toolboxes for psychophysical experiments. Most importantly the Psychophysics Toolbox (mainly for stimulus presentation) and the Eyelink Toolbox (controlling the SR-Research Eyelink Eyetracker). The Optotrak Toolbox can be used to integrate the Optotrak with these other research tools. Technically, the Optotrak Toolbox communicates with the Optotrak from within Matlab by using Northern Digital's C-API to compile Matlab MEX-files. The Optotrak Toolbox is currently tested under Windows 10, Windows 7, Windows XP, and Linux (Northern Digital's C-API doesn't support Mac OSX, therefore the Optotrak Toolbox also is not able to do so).

Sample programs

Here, you can find some sample programs for the Optotrak Toolbox: Each sample is a 1-to-1 translation of one of the sample C-programs which are shipped with the Optotrak API


If you are interested in the Optotrak Toolbox, I will be happy to send you a copy by email (the Optotrak Toolbox is open software under the GNU general public license, such that it is free and you can modify the source code if you wish). Currently, the Optotrak Toolbox does not fully implement all features of Northern Digital's C-API but it is used successfully by many labs around the world (including my own lab where we have used it since 2004 with many different versions of Matlab on Windows and Linux and with both, the Optotrak 3020 and the Optotrak Certus). Note, however, that I cannot and will not provide support for it. The prerequisites to use it on your side are:
  • Northern Digital's Optotrak Certus or Optotrak 3020.
  • Northern Digital's C-API (you need to have purchased this in addition to the Optotrak)
  • Windows or Linux (better tested on Windows).
  • A C-compiler (Northern Digital's C-API works best with Microsoft's Visual C++ Compiler which is nowadays freely available)
  • ... and of course Matlab. Currently (i.e., as of 2021): This could be either a 64-bit or a 32-bit version of Matlab (but make sure you have the corresponding 64 or 32-bit version of Northern Digital's C-API).
  • You can compile the OptotrakToolbox from within Matlab and do not necessarily need to first compile the C-API's sample programs in C. However, in case you run into problems, I advice you to check whether you are able to compile the native C-API's sample programs in C. Many (if not most) problems arise at this level and not at the level of the OptotrakToolbox. This compilation can be awkward and you might need once a C-savvy person...

It is free, but consider citing it!

If you use the Optotrak Toolbox for a scientific paper, please consider citing it. For example like this:
Movement recording was controlled with the Optotrak Toolbox by V. H. Franz ( within Matlab (Mathworks, Natick, MA, USA).