Home > functions > gui > preAnalysis > trial_extractor > private > vb_trigger_new.m

vb_trigger_new

PURPOSE ^

This is a virtual function.

SYNOPSIS ^

function [obj] = vb_trigger_new(ch_name, trig_type, trig_level)

DESCRIPTION ^

 This is a virtual function.
 DO NOT CALL DIRECTORY.
 This function assumed to be called from inherit class.
 [USAGE]
    obj = vb_trigger_new(ch_name, trig_type, trig_level);
 [IN]
       ch_name : extract trigger from this channel(s) [string or cell]
     trig_type : trigger type such as 'voice' 'integer', 'analog', 'emg'
    trig_level : trigger level. 
                 The meaning of this parameter will vary by the type of trigger.
 [OUT]
    obj : trigger object

 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 [obj] = vb_trigger_new(ch_name, trig_type, trig_level)
0002 % This is a virtual function.
0003 % DO NOT CALL DIRECTORY.
0004 % This function assumed to be called from inherit class.
0005 % [USAGE]
0006 %    obj = vb_trigger_new(ch_name, trig_type, trig_level);
0007 % [IN]
0008 %       ch_name : extract trigger from this channel(s) [string or cell]
0009 %     trig_type : trigger type such as 'voice' 'integer', 'analog', 'emg'
0010 %    trig_level : trigger level.
0011 %                 The meaning of this parameter will vary by the type of trigger.
0012 % [OUT]
0013 %    obj : 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 funcion needs 3 arguments. Please check your code.');
0023 end
0024 if ~iscellstr(ch_name) && ~ischar(ch_name)
0025     error('Invalid channel name was specified.');
0026 end
0027 if ~ischar(trig_type)
0028     error('Invalid trigger type was specified.');
0029 end
0030 if ~isempty(trig_level) && ~isnumeric(trig_level)
0031     error('Invalid trigger level was specified.');
0032 end
0033 
0034 %
0035 % --- Main Procedure
0036 %
0037 obj = struct;
0038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0039 % obj.FIELDNAMES SHOULD BE SAME WITH vb_get_trial_time_index
0040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0041 if ischar(ch_name)
0042     obj.status_ch = {ch_name};
0043 elseif iscellstr(ch_name)
0044     obj.status_ch = ch_name;
0045 end
0046 
0047 obj.trig_type    = trig_type;
0048 obj.status_level = trig_level;
0049 
0050 %
0051 % --- After check
0052 %
0053 if nargout < 1
0054     error('function caller should receive this object.');
0055 end

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