Home > functions > device > active_check > vb_find_bad_trial.m

vb_find_bad_trial

PURPOSE ^

find bad channel & bad trials with large max_ratio

SYNOPSIS ^

function [ix_try,flg] = vb_find_bad_trial(ratio1,ratio2,ch_act,thred_val,num)

DESCRIPTION ^

 find bad channel & bad trials with large max_ratio
  [ix_try] = vb_find_bad_trial(ratio1,ratio2, ch_act, thred_val)
 ratio1,ratio2 : max ratio : large value indicates bad channel & bad trials
 thred_val : threshold value
 ch_act : list of good channel
 ix_try : list of bad trials
 
 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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    [ix_try,flg] = vb_find_bad_trial(ratio1,ratio2,ch_act,thred_val,num)
0002 % find bad channel & bad trials with large max_ratio
0003 %  [ix_try] = vb_find_bad_trial(ratio1,ratio2, ch_act, thred_val)
0004 % ratio1,ratio2 : max ratio : large value indicates bad channel & bad trials
0005 % thred_val : threshold value
0006 % ch_act : list of good channel
0007 % ix_try : list of bad trials
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(ch_act,:) > thred_val(1)) ...
0022         | (ratio2(ch_act,:) > thred_val(1)) ;
0023 case    2
0024     % bad channel/trial with large max_ratio
0025     flg = (ratio1(ch_act,:) > thred_val(1)) ...
0026         | (ratio2(ch_act,:) > thred_val(2)) ;
0027 case    3
0028     % bad channel/trial with large max_ratio
0029     flg = (ratio1(ch_act,:) > thred_val(1)) ...
0030         | (ratio2(ch_act,:) > thred_val(2)) ...
0031         | (ratio1(ch_act,:) < thred_val(3));
0032 end
0033 
0034 % Bad trial with large max_ratio after removing bad channel
0035 if nargin == 5
0036     ix_try = find( sum(flg, 1) >= num);
0037 else
0038     ix_try = find( sum(flg, 1) > 0);
0039 end
0040 
0041 return
0042 %%% END %%%

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005