0001 function [Epoch,Window_Length,NEpoch,Nbad_chan,bad_chan,reference,ravgcsdm,iavgcsdm] = rd_csdm(fid);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 if nargin < 1
0015 error('wheres the fid')
0016 end;
0017
0018 Epoch = fread(fid,1,'integer*2');
0019 Window_Length = fread(fid,1,'integer*2');
0020 NEpoch = fread(fid,1,'integer*2');
0021 Nbad_chan = fread(fid,1,'integer*2');
0022 bad_chan = fread(fid,[1,Nbad_chan],'integer*2');
0023 ref_flag = fread(fid,1,'integer*2');
0024 if ref_flag == 1
0025 reference = 'average';
0026 elseif ref_flag == 2
0027 reference = 'avgmast';
0028 elseif ref_flag == 3
0029 reference = 'perimeter';
0030 elseif ref_flag == 4
0031 reference = 'vertex';
0032 elseif ref_flag == 5
0033 reference = 'laplacian';
0034 elseif ref_flag == 6
0035 nchan = fread(fid,1,'integer*2');
0036 reference = fread(fid,[1,nchan],'integer*2');
0037 elseif ref_flag == 7
0038 sigma_v = fread(fid,1,'integer*2');
0039 if sigma_v > 9
0040 reference = ['cortical' int2str(sigma_v)];
0041 else
0042 reference = ['cortical0' int2str(sigma_v)];
0043 end
0044 end;
0045 nfreq = fread(fid,1,'integer*2');
0046 nchan2 = fread(fid,1,'integer*2');
0047 ravgcsdm = fread(fid,[nchan2,nfreq],'real*4');
0048 iavgcsdm = fread(fid,[nchan2,nfreq],'real*4');
0049 ravgcsdm = ravgcsdm';
0050 iavgcsdm = iavgcsdm';
0051
0052
0053
0054
0055
0056
0057
0058
0059