<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7232.14">
<TITLE>converting .set data back to .cnt or .eeg neuroscan data file</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<UL>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="Arial">Hi,</FONT><FONT FACE="Simsun"> </FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="Arial">I think this topic has been touched before.</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">I want to convert the eeglab .set data into .cnt or .eeg neuroscan </FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">file for further analysis in other software.</FONT></SPAN><SPAN LANG="zh-cn"></SPAN><SPAN LANG="zh-cn"><FONT FACE="Arial"><BR>
</FONT><FONT SIZE=2 FACE="Arial">There are some codes uploaded before</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> (as following)</FONT></SPAN><SPAN LANG="zh-cn"> <FONT SIZE=2 FACE="Arial">.</FONT><FONT FACE="Arial"><BR>
</FONT><FONT SIZE=2 FACE="Arial">But it seems not work?</FONT><FONT FACE="Arial"> </FONT></SPAN>
</P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">The input 'dataset' is the CNT-dataset you </FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">already have or a blank structure?</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">This works for converting to .eeg data?</FONT></SPAN><SPAN LANG="zh-cn"></SPAN><SPAN LANG="zh-cn"></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="Arial">Anybody has implemented those code?</FONT><FONT FACE="Arial"><BR>
</FONT><FONT SIZE=2 FACE="Arial">or anybody has any other good suggestions?</FONT><FONT FACE="Arial"><BR>
</FONT><FONT SIZE=2 FACE="Arial"> </FONT><FONT FACE="Arial"></FONT> </SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="Arial">Thank you very much!</FONT><FONT FACE="Simsun"> </FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="Arial">Regards,</FONT><FONT FACE="Simsun"> </FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="Arial">qi yang</FONT><FONT FACE="Simsun"> </FONT></SPAN>
</P>
<BR>
<BR>
<BR>
</UL>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% writecnt() - Write a Neuroscan continuous signal file.</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">%</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% Usage:</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% >> writecnt(filename, CNT-dataset, varargin) </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">%</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% Inputs:</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% filename - name of the file with extension</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% dataset - name of the CNT-dataset, a structure with the following fields</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% cntdataset.header</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% cntdataset.electloc</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% cntdataset.data</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% cntdataset.Teeg</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% cntdataset.event</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% cntdataset.tag</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% cntdataset.endtag</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">%</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% Optional inputs:</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% 't1' - start at time t1, default 0</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% 'sample1' - start at sample1, default 0, overrides t1</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% 'lddur' - duration of segment to load, default = whole file</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% 'ldnsamples' - number of samples to load, default = whole file, </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% overrides lddur</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% 'scale' - ['on'|'off'] scale data to microvolt (default:'on')</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% 'dataformat' - ['int16'|'int32'] default is 'int16' for 16-bit data.</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% Use 'int32' for 32-bit data.</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">%</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% Outputs:</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% file - file containing NeuroScan CNT file with the continuous</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% data and other information</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">%</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% Authors: Sean Fitzgibbon, Arnaud Delorme, Michiel Vestjens 2000-2004</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">%</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% Known limitations: </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% For more see <A HREF="http://www.cnl.salk.edu/~arno/cntload/index.html">http://www.cnl.salk.edu/~arno/cntload/index.html</A> </FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">%123456789012345678901234567890123456789012345678901234567890123456789012</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% Copyright (C) 2000 Sean Fitzgibbon, <psspf at id.psy.flinders.edu.au></FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% Copyright (C) 2003 Arnaud Delorme, Salk Institute, arno at salk.edu</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">%</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% This program is free software; you can redistribute it and/or modify</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% it under the terms of the GNU General Public License as published by</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% the Free Software Foundation; either version 2 of the License, or</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% (at your option) any later version.</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">%</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% This program is distributed in the hope that it will be useful,</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% but WITHOUT ANY WARRANTY; without even the implied warranty of</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% GNU General Public License for more details.</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">%</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% You should have received a copy of the GNU General Public License</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% along with this program; if not, write to the Free Software</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">function f = writecnt(filename,cntdataset,varargin)</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">if ~isempty(varargin)</FONT></SPAN>
<BR><SPAN LANG="zh-cn"> <FONT SIZE=2 FACE="宋体"> WriteOptions=struct(varargin{:});</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">else WriteOptions = []; </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">end;</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">try, WriteOptions.t1; catch, WriteOptions.t1=0; end</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">try, WriteOptions.sample1; catch, WriteOptions.sample1=[]; end</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">try, WriteOptions.lddur; catch, WriteOptions.lddur=[]; end</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">try, WriteOptions.ldnsamples; catch, WriteOptions.ldnsamples=[]; end</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">try, WriteOptions.scale; catch, WriteOptions.scale='on'; end</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">try, WriteOptions.dataformat; catch, WriteOptions.dataformat='int16'; end</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">sizeEvent1 = 8 ; %%% 8 bytes for Event1 </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">sizeEvent2 = 19 ; %%% 19 bytes for Event2 </FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">type='cnt';</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">if nargin ==1 </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> scan=0;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">end </FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">h = cntdataset.header;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">e = cntdataset.electloc;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">dat = cntdataset.data;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">eT = cntdataset.Teeg;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">ev2 = cntdataset.event;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">t = cntdataset.tag;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">endtag=cntdataset.endtag;</FONT></SPAN>
</P>
<BR>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fid = fopen(filename,'w');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">disp(['Writing file ' filename ' ...'])</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% HEADER : 900 bytes => Starts at 0h, finishes with 383h.</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.rev,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.nextfile,'long');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.prevfile,'long');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.type,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.id,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.oper,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.doctor,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.referral,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.hospital,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.patient,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.age,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.sex,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.hand,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.med,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.category,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.state,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.label,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.date,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.time,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.mean_age,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.stdev,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.n,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.compfile,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.spectwincomp,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.meanaccuracy,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.meanlatency,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.sortfile,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.numevents,'int');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.compoper,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.avgmode,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.review,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.nsweeps,'ushort');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.compsweeps,'ushort');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.acceptcnt,'ushort');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.rejectcnt,'ushort');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.pnts,'ushort');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.nchannels,'ushort');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.avgupdate,'ushort');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.domain,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.variance,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.rate,'ushort');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.scale,'double');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.veogcorrect,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.heogcorrect,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux1correct,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux2correct,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.veogtrig,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.heogtrig,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux1trig,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux2trig,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.heogchnl,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.veogchnl,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux1chnl,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux2chnl,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.veogdir,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.heogdir,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux1dir,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux2dir,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.veog_n,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.heog_n,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux1_n,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux2_n,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.veogmaxcnt,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.heogmaxcnt,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux1maxcnt,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux2maxcnt,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.veogmethod,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.heogmethod,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux1method,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.aux2method,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.ampsensitivity,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.lowpass,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.highpass,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.notch,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.autoclipadd,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.baseline,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.offstart,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.offstop,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.reject,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.rejstart,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.rejstop,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.rejmin,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.rejmax,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.trigtype,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.trigval,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.trigchnl,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.trigmask,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.trigisi,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.trigmin,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.trigmax,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.trigdir,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.autoscale,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.n2,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.dir,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.dispmin,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.dispmax,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.xmin,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.xmax,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.automin,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.automax,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.zmin,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.zmax,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.lowcut,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.highcut,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.common,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.savemode,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.manmode,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.ref,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.rectify,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.displayxmin,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.displayxmax,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.phase,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.screen,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.calmode,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.calmethod,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.calupdate,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.calbaseline,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.calsweeps,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.calattenuator,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.calpulsevolt,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.calpulsestart,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.calpulsestop,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.calfreq,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.taskfile,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.seqfile,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.spectmethod,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.spectscaling,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.spectwindow,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.spectwinlength,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.spectorder,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.notchfilter,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.headgain,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.additionalfiles,'int');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.unused,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.fspstopmethod,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.fspstopmode,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.fspfvalue,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.fsppoint,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.fspblocksize,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.fspp1,'ushort');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.fspp2,'ushort');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.fspalpha,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.fspnoise,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.fspv1,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.montage,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.eventfile,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.fratio,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.minor_rev,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.eegupdate,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.compressed,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.xscale,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.yscale,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.xsize,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.ysize,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.acmode,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.commonchnl,'uchar');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.xtics,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.xrange,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.ytics,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.yrange,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.xscalevalue,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.xscaleinterval,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.yscalevalue,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.yscaleinterval,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.scaletoolx1,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.scaletooly1,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.scaletoolx2,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.scaletooly2,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.port,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.numsamples,'ulong');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.filterflag,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.lowcutoff,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.lowpoles,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.highcutoff,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.highpoles,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.filtertype,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.filterdomain,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.snrflag,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.coherenceflag,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.continuoustype,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.eventtablepos,'long');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.continuousseconds,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.channeloffset,'long');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.autocorrectflag,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fwrite(fid,h.dcthreshold,'uchar'); % = 383H</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% ELECT.DESCRIPTIONS : 75*n.channels bytes.</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% Starts with 384h, finishes with (899+75*nchannels)dec</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% 10 channels: 671h % 12 channels: 707h</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% 24 channels: A8Bh % 32 channels: CE3h</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% 64 channels: 1643h % 128 channels: 2903h</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">for n = 1:h.nchannels</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).lab,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).reference,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).skip,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).reject,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).display,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).bad,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).n,'ushort');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).avg_reference,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).clipadd,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).x_coord,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).y_coord,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).veog_wt,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).veog_std,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).snr,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).heog_wt,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).heog_std,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).baseline,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).filtered,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).fsp,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).aux1_wt,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).aux1_std,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).senstivity,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).gain,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).hipass,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).lopass,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).page,'uchar');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).size,'uchar');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).impedance,'uchar');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).physicalchnl,'uchar');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).rectify,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,e(n).calib,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">end</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% finding if 32-bits of 16-bits file</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% ----------------------------------</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">begdata = ftell(fid);</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">enddata = h.eventtablepos; % after data</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">if strcmpi(WriteOptions.dataformat, 'int16')</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> nums = (enddata-begdata)/h.nchannels/2;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">else nums = (enddata-begdata)/h.nchannels/4;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">end;</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% number of sample to write</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% -------------------------</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">if ~isempty(WriteOptions.sample1)</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> WriteOptions.t1 = WriteOptions.sample1/h.rate;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">else </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> WriteOptions.sample1 = WriteOptions.t1*h.rate;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">end;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">if strcmpi(WriteOptions.dataformat, 'int16')</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> startpos = WriteOptions.t1*h.rate*2*h.nchannels;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">else startpos = WriteOptions.t1*h.rate*4*h.nchannels;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">end;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">if isempty(WriteOptions.ldnsamples)</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> if ~isempty(WriteOptions.lddur)</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> WriteOptions.ldnsamples = round(WriteOptions.lddur*h.rate); </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> else WriteOptions.ldnsamples = nums; </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> end;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">end;</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% scaling data from microvolts</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% ----------------------------</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">if strcmpi(WriteOptions.scale, 'on')</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> disp('Scaling data .....')</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> for i=1:h.nchannels</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> bas=e(i).baseline;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> sen=e(i).senstivity;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> cal=e(i).calib;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> mf=sen*(cal/204.8);</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> dat(i,:)=(dat(i,:)/mf)+bas;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> end</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">end</FONT></SPAN>
</P>
<BR>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% write data</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">% ----------</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">disp('Writing data .....')</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">if type == 'cnt' </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> channel_off = h.channeloffset/2;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fseek(fid, startpos, 0);</FONT></SPAN>
<BR><SPAN LANG="zh-cn"> <FONT SIZE=2 FACE="宋体"> if channel_off <= 1</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> for temploop =1:WriteOptions.ldnsamples;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid, dat(1:h.nchannels, temploop), WriteOptions.dataformat)';</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> end;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> else</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> for temploop =1:h.nchannels;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid, dat(temploop, 1:channel_off), WriteOptions.dataformat)';</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> end;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> </FONT></SPAN>
<BR><SPAN LANG="zh-cn"> <FONT SIZE=2 FACE="宋体"> counter = 1; </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> while counter*channel_off < WriteOptions.ldnsamples</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> for temploop =1:h.nchannels;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid, dat(temploop, counter*channel_off+1:counter*channel_off+channel_off), WriteOptions.dataformat)';</FONT></SPAN></P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> end;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> counter = counter + 1;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"> <FONT SIZE=2 FACE="宋体"> end;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"> <FONT SIZE=2 FACE="宋体"> end; </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> % write event table</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> % -----------------</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> frewind(fid);</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fseek(fid,h.eventtablepos,'bof');</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> disp('Writing Event Table...')</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,eT.teeg,'uchar');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,eT.size,'ulong');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,eT.offset,'ulong');</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> if eT.teeg==2</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> nevents=eT.size/sizeEvent2;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> elseif eT.teeg==1</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> nevents=eT.size/sizeEvent1;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> else</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> disp('No !!! teeg <> 2 and teeg <> 1');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2 = [];</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> end </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> %%%% to change offset in points back to bytes </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> if ~isempty(ev2)</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2p=ev2; </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ioff=900+(h.nchannels*75); %% initial offset : header + electordes desc </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> for i=1:nevents </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2p(i).offset=((ev2p(i).offset + WriteOptions.sample1)*2*h.nchannels) +ioff; %% 2 short int end </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> end </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2 = ev2p;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> end;</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> if eT.teeg==2</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> nevents=eT.size/sizeEvent2;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> for i=1:nevents</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).stimtype = fwrite(fid,ev2(i).stimtype,'ushort');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).keyboard = fwrite(fid,ev2(i).keyboard,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).keypad_accept = fwrite(fid,ev2(i).keypad_accept,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).offset = fwrite(fid,ev2(i).offset,'long');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).type = fwrite(fid,ev2(i).type,'short'); </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).code = fwrite(fid,ev2(i).code,'short');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).latency = fwrite(fid,ev2(i).latency,'float');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).epochevent = fwrite(fid,ev2(i).epochevent,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).accept = fwrite(fid,ev2(i).accept,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).accuracy = fwrite(fid,ev2(i).accuracy,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> end </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> elseif eT.teeg==1</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> nevents=eT.size/sizeEvent1;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> for i=1:nevents</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).stimtype = fwrite(fid,ev2(i).stimtype,'ushort');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).keyboard = fwrite(fid,ev2(i).keyboard,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).keypad_accept = fwrite(fid,ev2(i).keypad_accept,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2(i).offset = fwrite(fid,ev2(i).offset,'long');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> end;</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> else</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> disp('No !!! teeg <> 2 and teeg <> 1');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> ev2 = [];</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> end </FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">end </FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">if size(endtag,1)>1</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,endtag);</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">else</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体"> fwrite(fid,t,'char');</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">end</FONT></SPAN>
</P>
<P><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">fclose(fid);</FONT></SPAN>
<BR><SPAN LANG="zh-cn"><FONT SIZE=2 FACE="宋体">disp(['Finished writing file ' filename ' ...'])</FONT></SPAN>
</P>
<BR>
<BR>
<BR>
</BODY>
</HTML>
<P>------------------------------------------------------------------------------<br>
Confidentiality Note: This message is intended for use only by the individual or entity to which it is addressed and may contain information that is privileged, confidential, and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. Thank you.<br>
------------<br>
Visit us online at our award-winning www.clevelandclinic.org for a complete listing of Cleveland Clinic services, staff and locations from one of the country's leading hospitals.<br>
==============================================================================<br>
</P>