0001 function outchdr= append_tspecs_v(inspecs,chdr,cell)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
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;