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

버전 1.0.0.0 (8.88 KB) 작성자: Jordan Sorokin
calculates peri-stimulus time histogram (PSTH) + variance of neural spike times
다운로드 수: 455
업데이트 날짜: 2016/2/19

라이선스 보기

% ---------[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
%-------------------------------------------------------

인용 양식

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

MATLAB 릴리스 호환 정보
개발 환경: R2013a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Electrophysiology에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
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