Home > eeg > egis > scripts > update_bad_chan.m

update_bad_chan

PURPOSE ^

SYNOPSIS ^

function status = update_bad_chan(new_bad_chan,powerfname);

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function status = update_bad_chan(new_bad_chan,powerfname);
0002 
0003 if nargin < 2
0004     [fid,powerfname] = get_fid('rb');
0005 else
0006     fid = fopen(powerfname,'rb');
0007 end;
0008 outfid = fopen([powerfname '.fix'],'wb');
0009 version = fread(fid,1,'int16')
0010 fwrite(outfid,version,'int16');
0011  [nfiles,obs_labels,Epoch,Window_Length,NEpoch,Nbad_chan,bad_chan,ref_flag,reference,NChan,NFreq] = rd_anal_hdr(fid);
0012 obs_labels = setstr(obs_labels);
0013 sbad = size(new_bad_chan,2);
0014 for i = 1:size(bad_chan,1)
0015     bad_chan(i,Nbad_chan(i)+1:Nbad_chan(i)+sbad) = new_bad_chan;
0016     Nbad_chan(i) = Nbad_chan(i)+sbad;
0017 end;
0018 
0019 wt_anal_hdr(outfid,nfiles,obs_labels,Epoch,Window_Length,NEpoch,Nbad_chan,bad_chan,ref_flag,reference,NChan,NFreq);
0020 
0021 for i = 1:nfiles
0022     power = fread(fid,[NChan(i), NFreq(i)],'real*4');
0023     fwrite(outfid,power,'real*4');
0024 end;
0025 fclose('all')
0026 status = 1;    
0027 
0028

Generated on Wed 20-Mar-2019 04:00:51 by m2html © 2003