Home > vbmeg > demo > test_scripts > sbi > readEOG.m

readEOG

PURPOSE ^

function Deeg=readEOG(sqddat,sysid)

SYNOPSIS ^

function Deeg=readEOG(sqddat,sysid)

DESCRIPTION ^

 function Deeg=readEOG(sqddat,sysid)
 Input: sqddat  % $SQDDAT  ex. /data1/toyama2/
        sysid   % System ID  ex. 1000987
 Output: Deeg(ch,samp,rept)  % measured voltage  [V]

 require accessSBI toolbox

 history
 2001-11-09 S.Kajihara
 2003-07-08 N.Goda

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function Deeg=readEOG(sqddat,sysid)
0002 % function Deeg=readEOG(sqddat,sysid)
0003 % Input: sqddat  % $SQDDAT  ex. /data1/toyama2/
0004 %        sysid   % System ID  ex. 1000987
0005 % Output: Deeg(ch,samp,rept)  % measured voltage  [V]
0006 %
0007 % require accessSBI toolbox
0008 %
0009 % history
0010 % 2001-11-09 S.Kajihara
0011 % 2003-07-08 N.Goda
0012 %
0013 % Copyright (C) 2011, ATR All Rights Reserved.
0014 % License : New BSD License(see VBMEG_LICENSE.txt)
0015 
0016 % file info.
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 % --- read eeg
0023 %
0024 if H_file.i_eeg_begin>0,
0025 % condition
0026     H_eeg=meg_hread('eeg',fid,H_file.i_eeg_begin);
0027     nch=H_eeg.i_nch;  % channel number
0028     nsamp=H_eeg.i_nsample;  % sampling number of measurement
0029     nrept=H_eeg.i_nwave;  % repeat number
0030     vbit=H_eeg.f_ad_weight;  % AD sense
0031    % for i=1:nch,
0032    %     H_eeg_ch=meg_hread('eeg_ch',fid,H_file.i_eeg_ch_begin+H_file.i_eeg_ch_size*(i-1));
0033    %     Ceeg{i}=H_eeg_ch.c_ch_name;
0034    % end
0035 % data
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     %nrept=nrept-1;
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    % Ceeg={}; % N.Goda
0047 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005