Find event onset time points for 'multi' channel bit pattern [ix,status_val,status_out] = ... vb_get_trigger_multi(status,status_level,parm); --- Input status : multi channel event signal [Nch x T] status_level : multi channel bit pattern [Nch x 1] parm.trig_type = 'multi' parm.slope = 'const_start' or 'const_end' parm.t_stay : minimum length to stay 'status_level' [default = 10] 'status' should be stay at the value 'status_level' for more than 't_stay' --- Output ix : time index corresponding to the event onset status_val = status_level status_out = Binarized status signal 2012-1-8 Masa-aki Sato Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [ix , status_val, status_out] = ... 0002 vb_get_trigger_multi(status,status_level,parm) 0003 % Find event onset time points for 'multi' channel bit pattern 0004 % 0005 % [ix,status_val,status_out] = ... 0006 % vb_get_trigger_multi(status,status_level,parm); 0007 % --- Input 0008 % status : multi channel event signal [Nch x T] 0009 % status_level : multi channel bit pattern [Nch x 1] 0010 % parm.trig_type = 'multi' 0011 % parm.slope = 'const_start' or 'const_end' 0012 % parm.t_stay : minimum length to stay 'status_level' [default = 10] 0013 % 'status' should be stay at the value 'status_level' 0014 % for more than 't_stay' 0015 % --- Output 0016 % ix : time index corresponding to the event onset 0017 % status_val = status_level 0018 % status_out = Binarized status signal 0019 % 0020 % 2012-1-8 Masa-aki Sato 0021 % 0022 % Copyright (C) 2011, ATR All Rights Reserved. 0023 % License : New BSD License(see VBMEG_LICENSE.txt) 0024 0025 if isfield(parm,'t_stay') 0026 t_stay = parm.t_stay; 0027 else 0028 t_stay = 10; 0029 end 0030 0031 ix = []; 0032 status_val = status_level; 0033 status_out = status; 0034 0035 switch lower(parm.trig_type) 0036 case 'multi' 0037 % Binarization 0038 smax = max(status,[],2); 0039 jj = find( smax > 0 ); 0040 status(jj,:) = vb_repmultiply(status(jj,:), 1./smax(jj)); 0041 status(jj,:) = ( status(jj,:) > 0.5 ); 0042 0043 switch lower(parm.slope) 0044 case 'const_start' 0045 ix = vb_multi_bit_start(status,status_level,t_stay); 0046 case 'const_end' 0047 ix = vb_multi_bit_end(status,status_level,t_stay); 0048 end 0049 0050 status_out = status; 0051 end