0001 function status = run_ns_edit(Epoch,Max_microv,Min_Chan,rawfname,Lo_Pass,Hi_Pass);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 if nargin < 3
0017 error('not enough input arguments');
0018 end;
0019 if nargin == 3;
0020 [infid, rawfname] = get_fid('rb');
0021 fclose(infid);
0022 end
0023 if rawfname == [];
0024 [infid, rawfname] = get_fid('rb');
0025 fclose(infid);
0026 infid = fopen(rawfname,'rb','b');
0027 else
0028 infid = fopen(rawfname,'rb','b');
0029 end;
0030 if infid < 1
0031 error('invalid filename')
0032 end
0033 outfname = [rawfname '.mask'];
0034 outfid = fopen(outfname,'wb');
0035 fid = infid;
0036 [header_array, EventCodes,Samp_Rate, NChan, scale, NSamp, NEvent] = rd_fragger_hdr(infid);
0037 if nargin == 6
0038 [Epoch, NEpoch,Max_microv,Min_Chan,NBad_chan,bad_chan,mask] = ns_artifact_edit(fid,Samp_Rate,NChan, NSamp, NEvent,scale,Epoch,Max_microv,Min_Chan,Lo_Pass,Hi_Pass);
0039 elseif nargin == 5
0040 [Epoch, NEpoch,Max_microv,Min_Chan,NBad_chan,bad_chan,mask] = ns_artifact_edit(fid,Samp_Rate,NChan, NSamp, NEvent,scale,Epoch,Max_microv,Min_Chan,Lo_Pass);
0041 else
0042 [Epoch, NEpoch,Max_microv,Min_Chan,NBad_chan,bad_chan,mask] = ns_artifact_edit(fid,Samp_Rate,NChan, NSamp, NEvent,scale,Epoch,Max_microv,Min_Chan);
0043 end;
0044
0045
0046 status = write_mask(outfid,Epoch,NEpoch,NChan,Max_microv,Min_Chan,NBad_chan,bad_chan,mask);
0047
0048 disp('BAD CHANNELS ARE')
0049 bad_chan
0050
0051 disp('NUMBER OF AVAILABLE TRIALS')
0052 sum(mask(:,NChan+1))
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062