0001 function [ravgcsdm,iavgcsdm] = rd_meg_csdm(csdmfname);
0002
0003
0004
0005
0006 if isempty(csdmfname)
0007 [fid,csdmfname] = get_fid('rb');
0008 fclose(fid);
0009 end;
0010
0011 csdmfid = open_file_w_byte_order(csdmfname,-1);
0012
0013 version = fread(csdmfid,1,'integer*2');
0014 NChan_file = fread(csdmfid,1,'integer*2');
0015 NMeg = fread(csdmfid,1,'integer*2');
0016 NReference = fread(csdmfid,1,'integer*2');
0017 NEeg = fread(csdmfid,1,'integer*2');
0018 NAnalog = fread(csdmfid,1,'integer*2');
0019 NBad_chan = fread(csdmfid,1,'integer*2');
0020 bad_chan = fread(csdmfid,[1,NBad_chan],'integer*2');
0021 NEpoch = fread(csdmfid,1,'integer*2');
0022 Epoch = fread(csdmfid,1,'real*4');
0023 nfreq = fread(csdmfid,1,'integer*2');
0024
0025 ravgcsdm = fread(csdmfid,[NChan_file,nfreq],'real*4');
0026 ravgcsdm = ravgcsdm';
0027 iavgcsdm = fread(csdmfid,[NChan_file,nfreq],'real*4');
0028 iavgcsdm = iavgcsdm';
0029 fclose(csdmfid);
0030
0031
0032
0033
0034