Home > eeg > egis > egis_file_utils > append_tspecs_v.m

append_tspecs_v

PURPOSE ^

outchdr=append_tspecs_v(inspecs,chdr,cell)

SYNOPSIS ^

function outchdr= append_tspecs_v(inspecs,chdr,cell)

DESCRIPTION ^

outchdr=append_tspecs_v(inspecs,chdr,cell)

For use with the EGIS file utilities. 

Writes the vector inspecs to the structure chdr at the 
position specified by cell. Assumes the trial is NTrials
+1, and updates this value. Expands the chdr structure if
necessary.  

See Also:rd_ses_hdr_v, get_tspec_v.

Created 3/5/96 by Brian Rakitin
Udating of NTrials in chdr fixed 5/4/96 BCR

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function outchdr= append_tspecs_v(inspecs,chdr,cell)
0002 %outchdr=append_tspecs_v(inspecs,chdr,cell)
0003 %
0004 %For use with the EGIS file utilities.
0005 %
0006 %Writes the vector inspecs to the structure chdr at the
0007 %position specified by cell. Assumes the trial is NTrials
0008 %+1, and updates this value. Expands the chdr structure if
0009 %necessary.
0010 %
0011 %See Also:rd_ses_hdr_v, get_tspec_v.
0012 %
0013 %Created 3/5/96 by Brian Rakitin
0014 %Udating of NTrials in chdr fixed 5/4/96 BCR
0015 %
0016 
0017 %Call the script that defines the EGIS header constants
0018 ses_hdr_offsets_v;
0019 
0020 if ~(nargin==3 & nargout==1)
0021     error('Function append_tspecs_v requires 3 input and 1 output arguments.');
0022 end
0023 
0024 if cell==0
0025     error('Cell argument cannot be zero.');
0026 end
0027 
0028 if cell > size(chdr,1)
0029     error(['Cell argument must be no greater than ' int2str(size(chdr,1))]);
0030 end
0031 
0032 if size(inspecs)~=floor(chdr(cell,LSpec)/2)
0033     error(['Input argument inspecs must be length ' int2str(floor(chdr(cell,LSpec)/2))]);
0034 end
0035 
0036 trial=chdr(cell,NTrials)+1;
0037 chdr(cell,NTrials)=trial;
0038 numspecs=floor(chdr(cell,LSpec)/2);
0039 tspec_offset = 6+((trial-1)*numspecs); 
0040 if (tspec_offset+numspecs-1) <= size(chdr,2)
0041     outchdr=chdr;
0042 else
0043     outchdr=zeros(size(chdr,1),(trial*numspecs)+5);
0044     outchdr(1:size(chdr,1),1:size(chdr,2))=chdr;
0045 end
0046 outchdr(cell,tspec_offset:(tspec_offset+numspecs-1))=inspecs;

Generated on Wed 20-Mar-2019 04:00:51 by m2html © 2003