Home > eeg > egis > egis_file_utils > wt_ses_hdr_v.m

wt_ses_hdr_v

PURPOSE ^

[status]=wt_ses_hdr_v(fid,fhdr,chdr,ename,czeros,cgains,cnames,fcom,ftext)

SYNOPSIS ^

function [status]=wt_ses_hdr_v(fid,fhdr,chdr,ename,czeros,cgains,cnames,fcom,ftext);

DESCRIPTION ^

[status]=wt_ses_hdr_v(fid,fhdr,chdr,ename,czeros,cgains,cnames,fcom,ftext)

This function creates a new EGIS header in the file with id fid.
The structures which are passed to this routine are the same as
are returned from function rd_ses_hdr_v (c.f.) prepended with the
output file id. The total number of elements written is returned.
Note that this number is NOT the header size in bytes.

See also:rd_ses_hdr_v.m

  Modification history:
    6/6/95    PJ    Fixed writing of LPad

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [status]=wt_ses_hdr_v(fid,fhdr,chdr,ename,czeros,cgains,cnames,fcom,ftext);
0002 %[status]=wt_ses_hdr_v(fid,fhdr,chdr,ename,czeros,cgains,cnames,fcom,ftext)
0003 %
0004 %This function creates a new EGIS header in the file with id fid.
0005 %The structures which are passed to this routine are the same as
0006 %are returned from function rd_ses_hdr_v (c.f.) prepended with the
0007 %output file id. The total number of elements written is returned.
0008 %Note that this number is NOT the header size in bytes.
0009 %
0010 %See also:rd_ses_hdr_v.m
0011 %
0012 %  Modification history:
0013 %    6/6/95    PJ    Fixed writing of LPad
0014 %
0015 
0016 ses_hdr_offsets_v;
0017 status=fseek(fid,0,'bof');
0018 status=fwrite(fid,fhdr(BytOrd),'int32');
0019 message=ferror(fid);
0020 if message ~= '',error(message),end
0021 
0022 status=fwrite(fid,fhdr(HdrVer),'int16');
0023 message=ferror(fid);
0024 if message ~= '', error(message),end
0025 
0026 status=fwrite(fid,fhdr(LHeader),'int16');
0027 message=ferror(fid);
0028 if message ~= '',error(message),end
0029 
0030 status=fwrite(fid,fhdr(LData),'int32');
0031 message=ferror(fid);
0032 if message ~= '',error(message),end
0033 
0034 status=fwrite(fid,abs(ename),'char');
0035 message=ferror(fid);
0036 if message ~= '',error(message),end
0037 
0038 status=fwrite(fid,fhdr(RunDate:BrdGain),'int16');
0039 message=ferror(fid);
0040 if message ~= '',error(message),end
0041 
0042 status=fwrite(fid,fhdr(LCellHdr:(LCellHdr+(fhdr(NCells)-1))),'int16');
0043 message=ferror(fid);
0044 if message ~= '',error(message),end
0045 
0046 status=fwrite(fid,czeros,'int16');
0047 message=ferror(fid);
0048 if message ~= '',error(message),end
0049 
0050 status=fwrite(fid,cgains,'int16');
0051 message=ferror(fid);
0052 if message ~= '',error(message),end
0053 
0054 for loop=1:fhdr(NCells)
0055     status=fwrite(fid,chdr(loop,1),'int16');
0056     message=ferror(fid);
0057     if message ~= '',error(message),end
0058     status=fwrite(fid,abs(cnames(loop,:)),'char');
0059     message=ferror(fid);
0060     if message ~= '',error(message),end
0061     lastrow=5+((chdr(loop,5)/2)*chdr(loop,2));
0062     status=fwrite(fid,chdr(loop,2:lastrow),'int16');
0063     message=ferror(fid);
0064     if message ~= '',error(message),end
0065 end
0066 
0067 status=fwrite(fid,fcom,'char');
0068 message=ferror(fid);
0069 if message ~= '',error(message),end
0070 
0071 status=fwrite(fid,ftext,'char');
0072 message=ferror(fid);
0073 if message ~= '',error(message),end
0074 
0075 status=fwrite(fid,zeros(fhdr(LPad),1),'char');
0076 message=ferror(fid);
0077 if message ~= '',error(message),end

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003