0001 function Deeg=readEOG(sqddat,sysid)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 fid=fopen(sprintf('%shead%s%s.hd',sqddat,filesep,sysid),'r','l');
0018 if fid==-1, disp('XXX Error : Cannot open head file !!'); ier=1; return; end
0019 H_file=meg_hread('file',fid);
0020
0021
0022
0023
0024 if H_file.i_eeg_begin>0,
0025
0026 H_eeg=meg_hread('eeg',fid,H_file.i_eeg_begin);
0027 nch=H_eeg.i_nch;
0028 nsamp=H_eeg.i_nsample;
0029 nrept=H_eeg.i_nwave;
0030 vbit=H_eeg.f_ad_weight;
0031
0032
0033
0034
0035
0036 fid0=fopen(sprintf('%seeg%s%s.eeg',sqddat,filesep,sysid),'r','l');
0037 if fid0==-1, disp('XXX Error : Cannot open eeg file !!'); ier=1; return; end
0038
0039 a=fread(fid0,nrept*nch*nsamp,'short');
0040 fclose(fid0);
0041 Deeg0=(reshape(a,nch,nsamp*nrept)).*vbit; clear a;
0042 Deeg=(reshape(Deeg0(13:14,:),2,nsamp,nrept)); clear Deeg0;
0043 else,
0044 disp('*** Warning : Not measured EEG !!');
0045 nch=0; nsamp=0; nrept=0; ch_name='none'; Deeg=0;
0046
0047 end