Introduction
As part of an effort to make inexpensive and flexible biology lab instrumentation, we have written a Matlab program which:
We used Matlab because it is a flexible programming language which includes the abilities to:
Each program description is divided into two parts; program use and program internal structure. Obviously, you don't need to understand the program internals to use it, as long as nothing goes wrong.
Using the Program
If you want to use the program you must have a licensed copy of Matlab
release 12. Later in the fall we expect to have a version which will run
standalone without Matlab. You then need to download the program
we wrote. Be sure that your Matlab 'path' includes the folder where you stored
the program. If you are not sure use the SetPath...
option in the
File
menu to investigate. This program is cycle and memory hungary.
It may not work well on slow machines. I have tested on an 866 MHz P3 with 256
Meg of memory.
The GUI consists of three plotting axes and their related controls.
The three plots:
Load
button. Use the dialog box which pops up to select
a file saved from the data aqusition
program. A simulated test file is here. Cllick
the save link as ...
option to use this file. The test file
contains two simulated units. The small amplitude unit fires about twice
as often as the bigger unit. About 200 spikes werre expected for the smaller
unit and about 100 for the larger unit. The 7 larger units are summated
artifacts. Expand T
and Reset T
buttons enable zooming
and panning. Zooming is performed by click-dragging the mouse over the
region of interest. Panning is performed by a slider which appears when
time is expanded.Invert
button flips the input data.Audio
button plays the wavefrom through the sound card.Compute
button, an amplitude histogram
of the spikes is plotted at the lower left and a group of windowed spike interval
histograms are plotted at the lower right. A separate histogram is plotted
for each active amplitude window.A legend is added to the lower-right plot
which gives the averate ISI and number of action potentials in each active
amplitude window.window threshold
buttons. When a window threshold button is
selected, the window's lower edge amplitude value may be set. The top edge
of the highest window is the maximum amplitude spike detected.1/ISI vs t
button opens a separate window with a plot
of 'instantaneous frequency' vs time for each of the windowed spike trains.
You have to push the Compute
button before you use this
feature. 1/ISI-XL
button exports the instantaneous frequency vs
time data to an Excel spreadsheet. You have to push the Compute
button before you use this feature.
Program Internal Organization
The program is structured as a Matlab function. Persistant data is stored in
the UserData
area of the figure. The initial execution of the function
from the command line initializes a bunch of variables and the GUI, then exits.
At that point, the GUI is drawn in the figure window and all the GUI controls
are waiting patiently for a user action. Control returns to the main function
when the user triggers a GUI element, and hence a callback function. Each of
the callbacks passes a string to the main function which is dispatched by a
gigantic case
statement to perform an action, perhaps modify the
persistant data, then exit. Since the main function is not running most of the
time, the Matlab command line stays active.