Create multi channel pattern trigger. [USAGE] [obj] = vb_multi_trigger_new(ch_name, pattern); [IN] ch_name : extract trigger from this channel(s) [string or cell] slope : trigger slope. ('const_start' or 'const_end') [string] pattern : Channel pattern. each index correspond to each ch_name. [0 or 1] e.g. ch_name = {'420', '421', '422', '423'} pattern = [1, 0, 0, 1]; [OUT] obj : multi_trigger object Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [obj] = vb_multi_trigger_new(ch_name, slope, pattern) 0002 % Create multi channel pattern trigger. 0003 % 0004 % [USAGE] 0005 % [obj] = vb_multi_trigger_new(ch_name, pattern); 0006 % [IN] 0007 % ch_name : extract trigger from this channel(s) [string or cell] 0008 % slope : trigger slope. ('const_start' or 'const_end') [string] 0009 % pattern : Channel pattern. each index correspond to each ch_name. [0 or 1] 0010 % e.g. ch_name = {'420', '421', '422', '423'} 0011 % pattern = [1, 0, 0, 1]; 0012 % [OUT] 0013 % obj : multi_trigger object 0014 % 0015 % Copyright (C) 2011, ATR All Rights Reserved. 0016 % License : New BSD License(see VBMEG_LICENSE.txt) 0017 0018 % 0019 % --- Previous check 0020 % 0021 if nargin < 3 0022 error('This function needs 3 argments. Please check your code.'); 0023 end 0024 if ~iscellstr(ch_name) && ~ischar(ch_name) 0025 error('ch_name must be char array or cell array of strings'); 0026 end 0027 if ~strcmp(slope, 'const_start') && ~strcmp(slope, 'const_end') 0028 error('trigger slope must be const_start or const_end'); 0029 end 0030 0031 % 0032 % --- Main Procedure 0033 % 0034 obj = vb_trigger_new(ch_name, 'multi', pattern); 0035 0036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0037 % obj.FIELDNAMES SHOULD BE DEFINED FOR vb_get_trial_time_index 0038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0039 obj.slope = slope; 0040 0041 % 0042 % --- After check 0043 % 0044 if nargout < 1 0045 error('function caller should receive this object.'); 0046 end