Skip to content

Laboratory of Neuropsychology

Getting Started with MatOFF

To read more about MatOFF, see the article

MatOFF: A Tool For Analyzing Behaviorally-Complex Neurophysiological Experiments

System requirements

MatOFFis designed to operate on a Microsoft Windows computer along with MATLAB (The Math Works) R2007b or later.  

Data files supported by MatOFF

MatOFF has its own internal data file structure.  Data from other programs are converted to the Cortex file format, then processed by MatOFFwith the Makdat command. Files are first converted to the Cortex file format because this is a very simple and well-documented format. Plexon(".plx") data files are converted to the Cortex format with mgplx2ctx. The program CortexExplorerCortex data file format. 

Obtaining MatOFF

MatOFF can be downloaded from the MatOFF download page

Installation

If you do not have MATLAB revision R2007b or later installed and tested on your computer, do that first.  We did not attempt to make MatOFF compatible with other, similar vector math languages like SciLab or Octave.  Perhaps it is possible to adapt MatOFF to these languages.  However,MatOFF relies very heavily on the MATLAB Windows GUI model and may not easily adapt to these other languages.

Installation of MatOFF is rather simple.  The only essential steps are to copy the "menus" directory to your hard disk and use the MATLAB Path Browser (File / Set Path... menu) to add a permanent path to that directory.  It is probably a good idea to create a separate working directory for your data files. The paths for CortexExplorer and mgplx2ctx must also be added to your path, if you plan to use these tools. 

MatOFF tries to detect the operating system you are using.  If there is any problem with this detection, modify the file ..\menus\matoff.m by changing the variable windows_version to match your system. 

EZSTART and Example Files 

MatOFF comes with a Cortex file and a script that will process the file and plot some results. See the README.TXT file in the /example_files/complete_with_datafile directory. The example is well-documented and very informative. Alternatively, try EZSTART. 

EZSTART lets you see your own data right away. EZSTART requires a CORTEX file. You can use your own or used the supplied file. You must know three things about the file. First, you need the event code number of the spike channel you wish to see. In Cortex the two default spike channel event codes are 1 and 2, but the Multispike entry of the Cortex.cfg file can change that. Second, you must know the event code for centering the rasters and histograms. Third, you need one additional event code that comes after the centering code. 

Once MatOFF is installed, exit MATLAB. Copy your data file to the MatOFF ezstart directory. Start MATLAB, change directory to the ezstart directory, then start MatOFF with the command "matoff". Once MatOFF is running, enter the EZSTART command in this format. ezstart 

For the example data file that comes with MatOFF, the command is: ezstart be003b.1 134 42 43 

MatOFF will generate a series of files in the ezstart directory, then process the spike data. If all goes well, MatOFF will generate a plot and play an annoying beep when it is done. The GUI and MatOFF commands can then be used to further explore the data. To view the commands that make up ezstart, see the file called ezstart.met. 

Starting MatOFF

Start up MATLAB. Change to your working directory to one that you will use for data analysis, then issue the command "matoff". You can use the MATLAB file called STARTUP.M to automate these steps. STARTUP.M is usually in the MATLAB\TOOLBOX\LOCAL directory. A simple example STARTUP.M file looks like this: 

% Startup for matoff
cd c:\data
clc
matoff

When MatOFF starts up it places several menus on the screen and prints these startup lines: 

Entering command mode. Use "matlab" to exit command mode.

Immediately after issuing the MatOFF prompt, MatOFF looks in the current working directory for a file named STARTUP.PRO. This is aprotocol file and can automatically run almost any group of MatOFF commands. 

The ">" prompt is the MatOFF command prompt. Use the Matlab command to return to the normal MATLAB prompt. From MATLAB theCmd command will bring back the MatOFF command prompt. The command Help will list the available MatOFF commands and associated help topics. Note that most MatOFF commands can be abbreviated. 

Typical MatOFF session

The first step to using MatOFF is to convert recorded files into the MatOFF data format.  With Cortex data files, this conversion is done using the Makdatcommand.  See the section on Importing data.  After the data have been converted, the data file can be opened by MatOFF.

File, unit, channel selections and search criteria

Here is an example sequence of commands to use after converting with  Makdat
file <file name>  Open the file in MatOFF
index  Look at the units available in this file
unit <unit name>  Select a unit from this list of units in this file
pulse <channel number>  Select a spike channel
analog <channel number>  Select an optional analog channel to be the "X" channel
ana2 <channel number>  Select an optional analog channel to be the "Y" channel
frequency <sample rate>  Analog data must have a sampling rate set
sequence <sequence list>  The search criteria for finding data trials of interest
globalignore <sequence list>   Used in conjunction with the Sequence command for selecting trials
center <sequence group number>  Alignment event for each trial. The value identifies a code group in theSequence command
mark <sequence group number>  This identifies another code group in the Sequence command and is used for certain statistics and trial ordering options

Time axis positioning

 At this point the program is ready to search for data that match the search criteria. You can initiate a search with the   Show  command. Results are plotted as soon as the search completes. It is common to set up the format of the plot, called the "layout," before issuing the   Show  command. Two commands set up the time axis.
window <window size> Number of milliseconds of data to show on the plot
shift <window position> Horizontal position of the time axis origin

Selecting items to plot

A group of commands select what types of data to plot. Here is a typical subset of the plotting options.
raster show Display one spike raster for each trial that was found during the search
histogram show Display histogram of the spike data
center show Draw a line at the time origin
avanalog show Draw a trace representing the average of all the X channel analog data
av2analog show Draw an average trace for the Y channel analog data

Making a plot

MatOFF  does no searching or related processing until a plot is requested.  A plot may be requested with the   Show,   Old plot, or   New plotcommand.  All three of these commands do essentially the same processing, but each offers different types of options.  
show Analyze and plot data
plot Save a plot file to disk
print Print the plot on the default printer

Ordering rasters

One powerful feature of   MatOFF  is the ability to reorder the display of raster traces.  The default ordering is chronological order with the earliest trial at the top of the display.  When a different ordering criteria is used, the process is called a   Sort.  A commonly used sort is   Sort time.  The   Center  and   Mark  commands listed above were used to identify two different events in each trial.  For instance, the center code could indicate when a trigger or "go" signal was given during an experiment.  The selected mark code could indicate when a target was acquired after the trigger signal.  The time from the trigger signal to the target acquisition might be an relevant measure of response time.  One could sort the spike rasters in order of response time.  The trials with shorter response times would be displayed first.  This sort is accomplished with the   Sort time  command.
sort time Reorder spike rasters and analog traces based on the elapse time between the center code and mark code
show Replot the data in using the new sort criterion.

Extracting numerical data

MatOFFs' powerful ability to locate trials that match complex search criteria can be harnessed for further data analysis.    MatOFF  can perform a few simple statistics and apply a non-parametric test (Mann Whitney U).  Further testing requires that   MatOFF  move extracted data to an ASCII disk file so other programs can work on the data.  Moving the results of a search to a disk file is accomplished with either the   Dump  or the   Setcommand.    Dump  sends data to the disk on a one-time bases;   Set  automatically moves data to a file each time a new plot is created. 
set sort keep Store the time between the center and mark events for each trial whenever a new plot is requested.
show Re-plot the data, which triggers data storage

Multiple plots per page

Another useful feature for data representation is the ability to place several plots onto one page. The   Axiscommand provides this feature.
axis multiplot <plots per page> set the number of plots on a page
axis subplot <plot number> choose where on the page the next plot will go

Batch Processing and Scripting

MatOFF is no slouch when it comes to automatic processing.  A hierarchical group of features all work together to provide flexible batch processing and a scripting environment. Virtually any MatOFF command may be placed into a script file, called a protocol file.  Moreover, protocol files themselves can be called from other protocol files and from DOS-like batch files, with replaceable parameters at each level of processing.  Read the section on Scripting language for details. 

MatOFF has an interface to MATLAB that allows the user to safely apply MATLAB programming to MatOFF.  See History scripting for details.