Home > eeg > egis > net_utils > rd_csdm_hdr.m

rd_csdm_hdr

PURPOSE ^

[Epoch,Window_Length,NEpoch,Nbad_chan,bad_chan,ref_flag,reference,nchan,nfreq] = rd_csdm_hdr(fid);

SYNOPSIS ^

function [Epoch,Window_Length,NEpoch,Nbad_chan,bad_chan,ref_flag,reference,nchan,nfreq] = rd_csdm_hdr(fid);

DESCRIPTION ^

[Epoch,Window_Length,NEpoch,Nbad_chan,bad_chan,ref_flag,reference,nchan,nfreq] = rd_csdm_hdr(fid);
 reads in csdm file

fid = valid csdm fid must have already cheacked for version = -1
Epoch = epochlength
Window_Length = total samples (seconds) into average
NEpoch = number of epochs
Nbad_chan = # of bad channels
bad_chan = bad_channels
reference = reference type or channel listg
avgcsdm = cross spectral density matrix
nchan = number of channels
nfreq = number of frequencies

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Epoch,Window_Length,NEpoch,Nbad_chan,bad_chan,ref_flag,reference,nchan,nfreq] = rd_csdm_hdr(fid);
0002 %[Epoch,Window_Length,NEpoch,Nbad_chan,bad_chan,ref_flag,reference,nchan,nfreq] = rd_csdm_hdr(fid);
0003 % reads in csdm file
0004 %
0005 %fid = valid csdm fid must have already cheacked for version = -1
0006 %Epoch = epochlength
0007 %Window_Length = total samples (seconds) into average
0008 %NEpoch = number of epochs
0009 %Nbad_chan = # of bad channels
0010 %bad_chan = bad_channels
0011 %reference = reference type or channel listg
0012 %avgcsdm = cross spectral density matrix
0013 %nchan = number of channels
0014 %nfreq = number of frequencies
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

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003