Downloads: Matlab

Downloads: Matlab

The Matlab section contains miscellaneous scripts that facilitate common tasks in Matlab, such as writing a cell a array to disk or cleaning up the workspace. Please consider rating them on Matlab Central if you liked them.

Some older scripts are further concerned with speeding up fMRI analyses; these scripts are somewhat dated (use with caution!) and they are bundled in the SPM section (SPM home). Scripts for analzying 2D movement trajectory data can also be found in their own section.

This & That


DLMCELL extends Matlabs I/O-capacities by writing cell arrays to delimited text files, independent of the variables within the cell (numbers or strings). DLMCELL is especially useful if you add its folder to Matlab's search path (type "pathtool" in the command line to do that).

If you downloaded an early version on Matlab Central (~prior to May 2010), please get this new bug-fixed version! P.S.: This script has been featured on File Exchange Pick of the Week!

CLEAR_ALL_BUT clears all variables in the workspace (like Matlab's clear command) but you may specify any number of variabltes to be kept in the workspace.

This script is also most useful if it is located in Matlab's search path.

CORE - COnstraint Randomization Environment - is a tool for creating controlled pseudo-random sequences, e.g. for trial sequences of behavioural experiments; have a look at the manual to find out more about it!

Unfortunately, CORE is not finalized and I have stopped working on the program. The current version should still feature some useful functionality.

Check out a few screenshots to find out more about CORE's current features:

CORE Screenshot



I have spent some time on creating batches for the most prominent fMRI analyses. Currently, the batches comprise preprocessing and 2nd level (random-effects) analysis (require the RunM-toolbar; see below), VOI extraction (spheres) and psychophysical interactions (PPIs). Click on the icon next to this text to download a bundle of all batches.

All batches were written for SPM8 (and are thus incompatible with prior versions) but the batches for VOI-extraction and PPIs are also available for SPM5.

This little script adds a new menu to SPM8's batch interface. The new option RunM lets you choose an M-file to be executed as part of an SPM batch.

This script won't run under prior versions of SPM.

It's actually possible to export fMRI data as an interactive 3D model within a PDF file. This eye-catching visualisation of fMRI data can easily be achieved with INVIND - see this example for a simple output of the program!

Do you happen to have a widescreen notebook with limited vertical display size? If yes: Annoyed by distorted and unlegible tables in the SPM graphics window? This little hack let's you change the size of all SPM windows.

A little tool for everyone who has to recode onsets for SPM analyses from time to time. The onset recoder comes with a graphical user interface; you only have to paste your data and receive neat multiple condition .mat-files. A compiled version for Matlab Compiler Runtime Environment 2009a is also available.

Movement Trajectories


Analyzing 2D movement trajectories can be done very easily in matlab. And corresponding scripts can be done comfortably with 9th-grade maths. Here, you can find such scripts for computing absolute distances (ADs) between a trajectory and a reference line, and the corresponding areas under the curve (AUCs). A demo script on how to use these functions is also available.

The corresponding results could look like this - as taken from experiments on deliberate rule violations (plotted with MS Excel):

Example Trajectory Data