find bad channel with large max_ratio for number of trials [ix_ch] = vb_find_bad_channel(ratio1,ratio2, thred_val, prob_val) ratio1,ratio2 : max ratio : large value indicates bad channel/trials thred_val : threshold value prob_val : probability for bad trials to select bad channel ix_ch : list of bad channel 2008-6-1 Masa-aki Sato 2009-1-9 Masa-aki Sato Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [ix_ch,flg] = vb_find_bad_channel(ratio1,ratio2,thred_val,prob_val) 0002 % find bad channel with large max_ratio for number of trials 0003 % [ix_ch] = vb_find_bad_channel(ratio1,ratio2, thred_val, prob_val) 0004 % ratio1,ratio2 : max ratio : large value indicates bad channel/trials 0005 % thred_val : threshold value 0006 % prob_val : probability for bad trials to select bad channel 0007 % ix_ch : list of bad channel 0008 % 0009 % 2008-6-1 Masa-aki Sato 0010 % 2009-1-9 Masa-aki Sato 0011 % 0012 % Copyright (C) 2011, ATR All Rights Reserved. 0013 % License : New BSD License(see VBMEG_LICENSE.txt) 0014 0015 %if length(thred_val)==1, thred_val = [thred_val, 150, 5]; end; 0016 %if length(thred_val)==2, thred_val = [thred_val, 5]; end; 0017 0018 switch length(thred_val) 0019 case 1 0020 % bad channel/trial with large max_ratio 0021 flg = (ratio1 > thred_val(1)) ... 0022 | (ratio2 > thred_val(1)) ; 0023 case 2 0024 % bad channel/trial with large max_ratio 0025 flg = (ratio1 > thred_val(1)) ... 0026 | (ratio2 > thred_val(2)) ; 0027 case 3 0028 % bad channel/trial with large max_ratio 0029 flg = (ratio1 > thred_val(1)) ... 0030 | (ratio2 > thred_val(2)) ... 0031 | (ratio1 < thred_val(3)); 0032 end 0033 0034 % bad channel with large max_ratio for number of trials 0035 ix_ch = find( sum(flg, 2) > prob_val*size(flg,2)); 0036 0037 return 0038 %%% END %%%