Home > chronux > spectral_analysis > pointbinned > extractdatapb.m

extractdatapb

PURPOSE ^

Extract segements of binned point process data between t(1) and t(2)

SYNOPSIS ^

function data=extractdatapb(data,Fs,t)

DESCRIPTION ^

 Extract segements of binned point process data between t(1) and t(2)
 Usage: data=extractdatapb(data,Fs,t)

 Input:
 data: binned point process data in the form samples x channels or single
 vector
 Fs: sampling frequency
 t   : time as a 2d vector [t(1) t(2)]
 Note that sampling frequency and t have to be in consistent units
 Output:
 data: data between t(1) and t(2)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function data=extractdatapb(data,Fs,t)
0002 % Extract segements of binned point process data between t(1) and t(2)
0003 % Usage: data=extractdatapb(data,Fs,t)
0004 %
0005 % Input:
0006 % data: binned point process data in the form samples x channels or single
0007 % vector
0008 % Fs: sampling frequency
0009 % t   : time as a 2d vector [t(1) t(2)]
0010 % Note that sampling frequency and t have to be in consistent units
0011 % Output:
0012 % data: data between t(1) and t(2)
0013 
0014 if nargin < 3; 
0015     error('need all three arguments');
0016 end;
0017 if t(1) < 0 || t(2)<=t(1);
0018     error('times cannot be negative and t(2) has to be greater than t(1)');
0019 end;
0020 data=change_row_to_column(data);
0021 N=size(data,1);
0022 tt=(0:N-1)/Fs;
0023 indx=find(tt>=t(1) & tt<=t(2));
0024 data=data(indx,:);

Generated on Fri 28-Sep-2012 12:34:30 by m2html © 2005