0001 function mask = artifact_edit_meg(trialdata,meg_channels,eeg_channels,MEG_max,EEG_max,add_bad_chan);
0002
0003
0004
0005
0006
0007 mask = ones(1,size(trialdata,2));
0008
0009 max_trialdata = max(abs(trialdata));
0010 bad_meg = find(max_trialdata(meg_channels) > MEG_max);
0011 if ~isempty(eeg_channels)
0012 bad_eeg = find(max_trialdata(eeg_channels) > EEG_max);
0013 mask(eeg_channels(bad_eeg)) =ones(size(bad_eeg,2));
0014 end;
0015
0016 mask(meg_channels(bad_meg)) = zeros(1,size(bad_meg,2));
0017 if ~isempty(add_bad_chan)
0018 mask(add_bad_chan) = zeros(1,size(add_bad_chan,2));
0019 end;
0020