CalculatePSTH(Spike​Times,start,varargi​n)

calculates peri-stimulus time histogram (PSTH) + variance of neural spike times
455 Descargas
Actualizado 19 feb 2016

Ver licencia

% ---------[psth] = CalculatePSTH(SpikeTimes,EventTimes,varargin)-------------
%
% Calculates peri-stimulus time histograms (PSTHs) from a matrix or cell
% array of spiketimes (in seconds), given a user-defined bin-width. Plots
% PSTHs and saves in current directory.
%
% >>> INPUTS >>>
% Required:
% SpikeTimes = matrix or cell of spiketimes in SECONDS
% If matrix, will assume columns are trials, rows are spiketimes.
% If cell, will assume each cell is a trial, and in each cell
% columns are channels, rows are spiketimes.
% start = n-element vector containing times of events (in seconds)...if
% spiketimes are relative (i.e. blocks of spikeitmes, each block relative
% to stim onset), then user should define "start" as the time of the
% onset of the stim relative to the start of the block. For instance, if
% stim is 6 seconds into the start of each block, then set "start" = 6.
% * if spikes NOT relative, start = nx1 array of starting times.
% Optional:
% pre_time = time (in SECONDS) to subtract from starting time...
% makes plots relative to stim onset (default = 1s);
% post_time = time (in SECONDS) to add to starting time...
% (default = 1s);
% bin_width = bin (ms) for PSTH calculation. Default = 10ms.
% name = name to save figure (default = "psth.pdf")
% saving = 0 or 1 (default 1). If 1, saves figures to current directory.
%
% <<< OUTPUTS <<<
% psth = bin-counts of spiketimes occuring within specified time range.
% If SpikeTimes is a cell array, psth is an nxtrialsxchan matrix.
% If SpikeTimes is a matrix, psth is an nxtrials matrix
% psthTrialAvg = average of psth across trials per channel
% varTrialAvg = average variance of psth across trials per channel
%
% Example:
% SpikeTimes{1} = sort(rand(100)); % fake spiketimes for ch1
% SpikeTimes{2} = sort(rand(100)); % fake spiketimes for ch2
% [psth,trialAvg,varAvg] = CalculatePSTH(SpikeTimes,.5,.2,.5,10,'control',1)
% % plots histogram and variances for each channel, from -0.2s : 0.5s
% % around the starting point, (here 0.5s into the SpikeTimes). Save
% % the figures and appends "control" to the figure name
%
% By JMS, 11/13/2015
%-------------------------------------------------------

Citar como

Jordan Sorokin (2024). CalculatePSTH(SpikeTimes,start,varargin) (https://www.mathworks.com/matlabcentral/fileexchange/55460-calculatepsth-spiketimes-start-varargin), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2013a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Electrophysiology en Help Center y MATLAB Answers.
Etiquetas Añadir etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versión Publicado Notas de la versión
1.0.0.0

commented on the requirement of this function on "EdgeCalculator", another function I've created for segmenting spike times based on bin widths