The purpose of this function of primarily for visual inspection of neural spike trains. It takes in a matrix of spike times or cell array, where each cell is composed of a matrix of spike times. The only requirements that this function imposes is that the matrix(ices) of spike times are in column-vector format. The function is more interpretable if everything is represented in seconds, however the actual plotting will work just as well if spike times, pre/post plotting times, and relative start times (i.e. origin on the x-axis) are in samples, milliseconds, etc.
SpikeTimes: an n x m matrix or cell array of n x m matrices of spike times, where n = total spikes, m = # trials.
If SpikeTimes is a single matrix, the function assumes the data comes from one channel only, and that m = # trials. If SpikeTimes is a cell array, the function assumes each cell is a separate channel. Multiple raster plots as subplots will be created, one for each channel. However, this will only work for up to 9 channels...this was chosen to avoid memory issues when plotting dense rasters.
Start = starting time of the event of interest. Usually rasters are plotted relative to an external stimulus to look at firing rate differences. The "start" here is arbitrary...we can set it to anything we like, however if if exceeds the maximum SpikeTime, we won't see any spikes on our plot.
Other optional inputs include:
Pretime = pre time from the "start" to plot
posttime = post time from the "start" to plot
tick = height of the individual tick marks
You can also specify to save the raster plot automatically or not, and can add a prefix to the filename. Refer to the function for more details on usage and inputs/outputs.
Jordan Sorokin (2021). PlotRasters(SpikeTimes,start,varargin) (https://www.mathworks.com/matlabcentral/fileexchange/54475-plotrasters-spiketimes-start-varargin), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!