Home > eeg > egis > egis_file_utils > tspecmat_from_chdr.m

tspecmat_from_chdr

PURPOSE ^

tsmat = tspecmat_from_chdr(chdr)

SYNOPSIS ^

function tsmat = tspecmat_from_chdr(chdr)

DESCRIPTION ^

 tsmat = tspecmat_from_chdr(chdr)

 Creates a matrix of tspec values

 Format of output matrix:

 Column 1: Cell ID
 Column 2: Entry number
 Column 3: Edit code

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function tsmat = tspecmat_from_chdr(chdr)
0002 % tsmat = tspecmat_from_chdr(chdr)
0003 %
0004 % Creates a matrix of tspec values
0005 %
0006 % Format of output matrix:
0007 %
0008 % Column 1: Cell ID
0009 % Column 2: Entry number
0010 % Column 3: Edit code
0011 %
0012 
0013 % 01/09/03  PJ  Fixed reshape command to be able to handle heterogeneous
0014 %               numbers of trials.
0015 
0016 ses_hdr_offsets_v;
0017 
0018 ncells = size(chdr,1);
0019 
0020 ntrials = chdr(:,NTrials);
0021 nspec = chdr(:,LSpec)/2;
0022 
0023 max_nspec = max(nspec);
0024 
0025 tsmat = [];
0026 
0027 for icell = 1:ncells
0028   tmp = reshape(chdr(icell,TSpecs:(TSpecs+max_nspec*ntrials(icell)-1)),max_nspec,ntrials(icell))';
0029   
0030   tsmat = [tsmat; ones(ntrials(icell),1)*icell (1:ntrials(icell))' tmp];
0031 end % for icell=

Generated on Wed 22-May-2019 04:00:51 by m2html © 2003