Context menu Intensity traces Correlation curves Number of correlations Display the average of the cross-correlations AxB and BxA Display the intensity histograms Record raw photon traces Integration time during live operation Integration time for recordings Histogram and photon trace bin time File format for the photon traces Set and use a file name template Running file number Remove the background Measure the background Start and stop live operation Record the correlations, histograms and intensity traces Update comments Comments and measurement notes Screen-shot of the graphical user interface

EPFLSTILOBMarcel LeuteneggerAbout

MATLAB toolbox

Flex02-xxD/C USB correlator interface

MATLAB toolbox

Data types

Double class
Extended class
Single class


Flex99-12C correlator
Flex02-0xD correlator
Vector functions


C-MEX wrapper
FPU instructions


Error function
Hankel transform


The Flex02-01D/C, Flex02-08D/C and Flex02-12D/C by are USB correlators for single- and dual-channel auto- and cross-correlation. These correlators simultaneously calculate up to four auto- and cross-correlations while recording the raw photon traces and the photon counting statistics (histograms). They are well-suited for fluorescence cross-correlation spectroscopy FCCS and similar methods.

This MATLAB interface provides an intuitive and simple access to the USB2.0 correlator hardware. It features automatic storage of the sample data, live control of the correlator hardware as well as live preview of the intensity trace, correlation curves (background corrected) and photon statistics.



Unpack the archive in a folder of your choice. Install the Flex02-xxD/C driver by Copy the SDK library "Flex02-xxDC.dll" into the private folder, start MATLAB and call "flex02.m".


Controls the display of the intensity traces. Either channel A or B can be hidden, or both can be cleared for resetting the axes limits to span only the current count rates. Count rates of channel A (in blue) and B (in red) for the most recent 30 seconds. The statusbar shows the elapsed integration time and the most recent count rates. Correlation amplitudes G versus lag time t. In dual mode, the auto-correlation AA or the cross-correlation AB are drawn in blue and the auto-correlation BB or the cross-correlation BA are drawn in red, respectively. In quad mode, AA is drawn in blue, BB in red, AB in black and BA in green, respectively.
To zoom in/out, select the desired range with a mouse drag. A double-click restores the default axes limits.
Selects the number of correlations. In single mode, either the auto-correlation AA or the cross-correlation AB is calculated with high resolution. In dual mode, either the auto-correlations AA and BB or the cross-correlations AB and BA are calculated. In quad mode, the auto-correlations AA and BB and the cross-correlations AB and BA are simultaneously calculated with low resolution. In quad mode, controls wheter the cross-correlations AB and BA are both displayed or averaged. In single and dual mode, switches between auto- or cross-correlation instead. Enables recording the photon counts every microsecond during a measurement. Requests the automatic file name generation (auto-save) to be turned on because the photon traces are directly written to a file. Sets the integration time during continous operation and during a measurement. In case of a measurement, the correlator is stopped and the aquired data is stored to a file once the requested time interval is elapsed. In continous operation, the correlator is periodically restarted instead. Controls the bin time for the photon counting histogram(s) and the format of the recorded photon trace. Automatic file name generation and auto-save. If activated, the measurement data is automatically stored to a file within the selected folder and with a file name composed of the three-digit running number, the defined file name template and ".mat" extension. In addition, the running number is increased. In this example, the next file name would be "002 2-color sample.mat". Measures the static background and enables correction of the live preview of the intensity traces and the correlation curves. Activates the continous operation of the correlator. The correlator is periodically restarted until the continous operation is turned off. Starts a measurement of the correlation curves, the intensity traces, the photon counting histograms and records the raw photon traces. If auto-save is deactivated, a file name will be requested. Screen-shot of the photon counting histograms displaying the probability P of counting n photons per microsecond. Update the comments and measurement notes in the last saved file. Screen-shot of the graphical user interface

Figure 1: Graphical user interface to the Flex02-xxD/C correlator. The intensity traces can be cleared or hidden with a context menu. The correlation axes and the photon counting histograms can be zoomed in.


The MATLAB interface to the Flex02-xxD/C USB hardware correlator is published as freeware. The author reserves the right to modify any of the contained files.

You are allowed to distribute this package as long as you deliver the entire, original package for free.

You are allowed to distribute modified versions of export.m and shutter.m as an extension package. In particular, you are not allowed to distribute a combination of modified files with other parts of the original package as a single archive.

Path File Description
/ flex02.m MATLAB interface
Readme.txt Summary
private/ export.m Save the correlation data to a file
flex02d0x.dll MATLAB interface library
flex02d0x.m MATLAB interface help and hardware emulation
shutter.m Automatic shutter control


Any warranty is strictly refused. Don't rely on any financial or technical support in case of malfunction or damage.

Comments are welcome. I will try to track reported problems and fix bugs.


May 28, 2006

Initial release of Flex02-08D/C interface.

July 19, 2006

Bug fix: substituted CPUTIME by NOW for compatibility with MATLAB 7.x.

July 19, 2008

Initial release of Flex02-01D/C interface.
Bug fix: file name template specification now compatible with MATLAB 7.x.

October 1, 2008

Magnitude of intensity traces in Flex02-01D/C interface fixed.

October 14, 2008

Correlation lengths fixed to match the current SDK conventions. In quad-mode the correlation length seems to be 288 instead of 304 as documented. If you get spikes or unexpected correlation results, please report.

April 29, 2009

Minor bug fixes and update of the user interfaces. Histogram options and comment box added.

April 11, 2011

Fixed two compatibility issues with MATLAB 2009+.


Downloading these files, you accept the copyright terms.


MATLAB is a registered trademark of The MathWorks, Inc. Windows is a trademark of Microsoft Corp. Other product or brand names are trademarks or registered trademarks of their respective holders.

2011 cole Polytechnique Fdrale de Lausanne