extractdatac

PURPOSE ^

Extract segements of continuous data between t(1) and t(2)

SYNOPSIS ^

function data=extractdatac(data,Fs,t)

DESCRIPTION ^

 Extract segements of continuous data between t(1) and t(2)
 Usage: data=extractdatac(data,Fs,t)

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

Generated on Fri 12-Aug-2011 11:36:15 by m2html © 2005