Home > eeg > egis > net_utils > rd_csdm.m

rd_csdm

PURPOSE ^

[Epoch,Window_Length,NEpoch,Nbad_chan,bad_chan,reference,ravgcsdm,iavgcsdm]

SYNOPSIS ^

function [Epoch,Window_Length,NEpoch,Nbad_chan,bad_chan,reference,ravgcsdm,iavgcsdm] = rd_csdm(fid);

DESCRIPTION ^

[Epoch,Window_Length,NEpoch,Nbad_chan,bad_chan,reference,ravgcsdm,iavgcsdm]
         = rd_csdm(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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

Generated on Thu 23-May-2019 04:00:50 by m2html © 2003