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