Authors guide for user contribution to the MEA-Tools toolbox.

It would be great if the MEA-Tools would grow through contributions of MCRack users, or maybe even go beyond this particular recording software. Several of the functions included are already written to work with generic matlab matrices or to exchange data from other data aquisition/analysis programs. We wrote these tools for one thing because we think that a uniform data analysis interface in Matlab is helpful independent of proprietary file formats. On the other hand it is useless to reinvent the wheel. Since we use other analysis software as well we did not include several important analysis tools that are incorporated in those other tools already, e.g. in Alex Kirilovs NeuroExplorer (NEX). Alex has included a Matlab link in his programs already and is writing an import option for MCRack files. Thus, if you miss some function in the MEA-Tools and wish to write it since you do not have NEX, or for other reasons, we will be happy to include it in future releases of the MEA-Tools.

Experienced matlab programmers checking through the MEA-Tools m-files will likely find code that would look better if it were rewritten. As is often the case, many m-files evolved in the course of my own work, had to account for different versions of MCRack and ongoing changes in my proficiency of matlab and programming style. Feel free to improve the code and add comments while you try to read the programs, but tell us where and what you changed.

Since we would like to make the MEA-Tools an easy-to-use set of tools and also keep it somewhat consistent in look and function we would appreciate if all contributors would stick to a few guidelines.
 

Documentation Guideline

     Documentation should be written in English.
     Programs should be documented according to the Matlab conventions, incl.  'See also' links to related or incorporated functions. Note that 'See
     also' links must be written in CAPTIAL letters, eg. shown below for 'surf.m', and must be the last line in the help section (any following comment words will
     be used as links, no matter how sensible that is).
 

  Example:

  %   See also SURFC, SURFL, MESH, SHADING.

The 'See' must have a capital S.
 

Function call style (i.e. function outputargument = mfile(inputargument) )

Although the style you use here is a matter of personal taste I find it very useful to keep the list of mandatory input arguments short and use the ..., varargin  argument with parameter/value pairs (PV pairs) to modify values for which meaningful default values can be given. The function pvpmod.m makes it very simple to evaluate such PV pairs. An example for extensive use of this construction is pcjkparams_d.m.

As a way to remind one of the input arguments possible in a function (and relieve me from remembering ugly argument and option lists) makes use of the inputdlg.m dialog box. It produces an easy-to-use graphical user interface in which you can display and modify the default values and comment on the arguments needed in a function call. See trace2mat.m as an example. I often use it such that the dialog box opens when a function is called without input arguments.

A luxury variant of this are the full scale GUIs, whose design might start with the template emptygui.m. Often control functions are a good strategy to handle GUI callbacks. They combine several commands within one m-file. This reduces the number of files around and facilitates debugging. See meatoolsboxctrl.m for an example.
 

Data formats
Continuous data and triggered sweeps.
Since many matlab functions work best and fastest across columns of data try to generate you matrices along these lines from the start. Transposing matrices (or any smart trick of that style) will generate intermediate variable eating up memory space. For example if you want to calculate the average shape of a spike load the spike data such that each row in the matrix represents one spike. mean(spikedatamatrix) will then require the least amout of space and time. Likewise will all filter routines. If you read through our m-files you will find that we, unfortunately, didn't follow this rule in datastream objects. We found out only later and changing all programs would be too much work. There is no reason, however, to repeat that mistake.
 

Spike data
The variables used for channel IDs, spike times, sorting results etc. are described in the overview page started from the MEA-Tools title menu.

Licencing
Please remember that we will distribute these files under GNU public license.