Spike Train Toolkit
     - Primer
     - Introduction
     - Toolkit Wiki
     - Download
     - Demonstrations
     - Input Format
     - Input Structures
     - Output Structures
     - Information Options
     - Entropy Options
     - Function Reference
     - Version History
     - License
     - Contribute
  Analysis Overview
     - Analyze Data
     - Your Submissions
  BrainML Models
  LNI Homepage
User ID

  Spike Train Analysis Toolkit Download/Installation

System Requirements

The Spike Train Analysis Toolkit requires:

The Toolkit has been tested on the following platforms (see the complete list of supported platforms):

  • Windows XP
    • Compiled with Microsoft Visual C++ .NET 2003, 2005 SP1, or 2008 (also known as Versions 7.1 Professional, 8.0 Professional, and 9.0 Express Editions). These PC compilers are among those fully supported by the Mathworks.
    • This compiler and its required files may no longer be available for download. The instructions are left here for legacy machines that have copies of the downloads. Compiled with Microsoft Visual C++ Toolkit 2003, a free version of the compiler from Microsoft Visual C++ .NET 2003. For information on installing and configuring Microsoft Visual C++ Toolkit 2003 for use with Matlab and the Spike Train Analysis Toolkit, please see this page.
    • Note: There is a correspondence between the version of Matlab used and the compiler. Specifically, Matlab R14 (released in 2004) will not be able to recognize Visual C++ 2005 or 2008.
    • Note: LCC, which is included with Matlab, will not work, as it is not directly compatible with Gsl for Windows.
  • Mac OS 10.3.9. Compiled with GCC 3.3.3, which is included in Xcode. Xcode is part of the Apple Developer Tools and can be downloaded by members of Apple Developer Connection (membership is free).
  • Redhat Linux (2.4 kernel): compiled with GCC 3.2.3.
  • Ubuntu 9.04 Desktop Linux: compiled with GCC 4.3.3.


  1. Download the compressed archive from neuroanalysis.org.
  2. Move the archive to the location where you would like the toolkit files to reside. When the archive is uncompressed, a directory named spike will be created and all of files will reside there. For example, if you want your files to be located in /home/username/spike/, move the archive to /home/username/.
  3. Uncompress the archive.



Configure your MEX environment if you have never done so. This is done by starting Matlab and issuing the following command:

>> mex -setup
More detailed instructions are given at the MathWorks site.


If you have not already done so, install the gsl, signal, and statistics packages from Octave-Forge. This is done by downloading the named package archive, starting Octave, and issuing the following command:

octave:1> pkg install package-name
where package-name is replaced with the name of the downloaded package file.

GNU Scientific Library (GSL) Setup


  1. Download Gsl for Windows from http://gnuwin32.sourceforge.net/downlinks/gsl.php. This link will direct you to a local mirror. Note that Gsl for Windows is a pre-compiled 32-bit version of GSL version 1.8 (April 2006). If you're running a 64-bit Windows operating system, however, you will need to download and compile GSL yourself. To help with compilation using Microsoft Visual C++, you may like to use the project files provided by computer expert Brian Gladman, which builds GSL version 1.13 (September 2009). Note that if using Brian Gladman's project files, you should have already performed step 3, but if not, make sure that you do. And take note of the alternate names for the created libraries (e.g., gsl.lib and cblas.lib), which may differ from those names mentioned in step 4.
  2. Run the executable file. Make a note of the folder where Gsl has been installed (e.g., C:\Program Files\GnuWin32). For the remainder of the documentation, we will represent this folder as <gsl_folder>.
  3. Go to Start Menu > Control Panel > System. Click on the Advanced tab. Click the button Environment Variables at the bottom of the tab. Add the following variables:
    Variable Value
    INCLUDE <gsl_folder>\include
    LIB <gsl_folder>\lib
    If these variables already exist, append contents above after the existing contents. Be sure to separate the paths with a semicolon. If you replace the existing contents, some programs on your system may cease to work properly. You may make these modifications in the user or system depending on the desired scope of the installation.
  4. Running the mex -setup command in Matlab will create a file called mexopts.bat in the user account's Matlab folder (e.g., <user>\Application Data\Mathworks\MATLAB\R14\mexopts.bat).
    1. You must find this file and open it using a text editor such as WordPad.
    2. Find the line that begins set LINK_FILE.
    3. At the end of this line, append libgsl.a libgslcblas.a.
    If you run mex -setup after you modify this file, this change will be overwritten and must be repeated.

Mac and Linux

  1. Download the GNU Scientific Library from ftp://ftp.gnu.org/gnu/gsl/, or use your distribution's package management tools to install the GSL development package.
  2. Follow the included installation instructions. You may need root/administrator access in order to install GSL completely. If you do not have these privileges, have your system administrator perform the installation of GSL. Note that some installations (particularly Mac) will place the GSL binaries and header files in non-standard locations. In this case, you will need to inform your compiler of these alternative locations, either by setting the environment variables C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, and LD_LIBRARY_PATH, or by passing the arguments -I/non/standard/include/path and -L/non/standard/library/path (where the path is replaced with the actual path to the GSL headers and binaries respectively) to the compiler on the command line.
  3. Depending on your Linux environment, you may need to include the directory that contains the files libgsl.so and libgslcblas.so (e.g., /usr/local/lib/) in LD_LIBRARY_PATH.
  4. Depending on the version of GCC that you are using, you may also need to create a symbolic link to the standard C++ library file (e.g., sudo ln -s /usr/lib/libstdc++.so.6.0.10 /usr/lib/libstdc++.so), and link Matlab to this and the shared GCC libraries (e.g., /$MATLABPATH/sys/os/$ARCH/libstdc++.so.6 and /$MATLABPATH/sys/os/$ARCH/libgcc_s.so.1 should point to the libraries on your system with which the MEX files were compiled).


  1. Start Matlab or Octave.
  2. Set the working directory to be the toolkit directory. For example,
    >> cd /home/username/spike
  3. Give the command to compile all of the files (see help make for additional options):
    >> make
  4. The spike train analysis toolkit is ready to go.
  5. In the demo/ directory, there is a script called staverify that performs a set of calculations to verify that the installation was successful (you may also run make('check') in Matlab or Octave). (Please note that if using Octave, the ctwmcmc_info test will not check the confidence intervals. This is because of minor differences between the functions prctile and random, as implemented in Matlab versus Octave, which would otherwise cause the test to fail. While this does not constitute a critical failure, Octave's prctile function, as implemented in the statistics package up to version 1.0.9, is known to have a bug.)
  6. Assuming that all tests pass when you run staverify, please take the time to add your system configuration to the list of our supported platforms.


If you have difficulty with compilation of the toolkit, please first take a look at our troubleshooting guide. If you still need help, please contact us.


Weill Medical College of Cornell University