Home > functions > internal > dsComputeRaster.m

dsComputeRaster

PURPOSE ^

dsComputeRaster - Use a threshold to find spiketrain for a voltage trace

SYNOPSIS ^

function raster = dsComputeRaster(t,V,threshold)

DESCRIPTION ^

dsComputeRaster - Use a threshold to find spiketrain for a voltage trace

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function raster  = dsComputeRaster(t,V,threshold)
0002 %dsComputeRaster - Use a threshold to find spiketrain for a voltage trace
0003   if nargin<3, threshold=0; end
0004   dt = t(2)-t(1);
0005   raster = [];
0006   [indTimes,neuronSpikes] = find (V > threshold);
0007   if ~isempty(neuronSpikes)
0008     tSpikes = t(indTimes); % in s
0009     raster(:,1) = tSpikes;
0010     raster(:,2) = neuronSpikes;
0011     raster(diff(raster(:,2))==0 & diff(raster(:,1))<=1.05*dt,:) = []; % removing artificial spikes that come from two consecutive voltages above 0 mV
0012     [~,indSort] = sort(raster(:,1));
0013     raster = raster(indSort,:);
0014   end

Generated on Tue 12-Dec-2017 11:32:10 by m2html © 2005