recognize trigger and status channel by label of transducer [usage] [idx, label] = vb_eeginfo_get_trigger_status_label(EEGinfo, trans) [input] EEGinfo : <required> current EEGinfo struct trans : <optional> Transduser field of EEGinfo.head (cell array) : ['Triggers and Status'] [output] idx : indeces of trigger (1 x N) label : trigger channel label (cell array) [note] [history] 2007-08-02 (Sako) initial version Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [idx, label] = vb_eeginfo_get_trigger_status_label(EEGinfo, trans) 0002 % recognize trigger and status channel by label of transducer 0003 % [usage] 0004 % [idx, label] = vb_eeginfo_get_trigger_status_label(EEGinfo, trans) 0005 % [input] 0006 % EEGinfo : <required> current EEGinfo struct 0007 % trans : <optional> Transduser field of EEGinfo.head (cell array) 0008 % : ['Triggers and Status'] 0009 % [output] 0010 % idx : indeces of trigger (1 x N) 0011 % label : trigger channel label (cell array) 0012 % [note] 0013 % 0014 % [history] 0015 % 2007-08-02 (Sako) initial version 0016 % 0017 % Copyright (C) 2011, ATR All Rights Reserved. 0018 % License : New BSD License(see VBMEG_LICENSE.txt) 0019 0020 % --- CHECK ARGUMENTS --- % 0021 if ~exist('EEGinfo', 'var'), EEGinfo = []; end; 0022 if ~exist('trans', 'var'), trans = []; end; 0023 [EEGinfo, trans] = inner_check_arguments(EEGinfo, trans); 0024 0025 0026 % --- MAIN PROCEDURE --------------------------------------------------------- % 0027 % 0028 vb_define_device; 0029 0030 idx = []; 0031 label = []; 0032 0033 transducers = EEGinfo.header.Transducer; 0034 label_base = vb_eeginfo_get_channel_label(EEGinfo); 0035 0036 for nt = 1:size(transducers,2) 0037 if strcmp(deblank(transducers(nt,:)), trans) 0038 next_idx = size(label,2) + 1; 0039 label{next_idx} = label_base{nt}; 0040 idx = [idx,nt]; 0041 end 0042 end 0043 0044 return; 0045 % 0046 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0047 0048 0049 % --- INNER FUNCTIONS -------------------------------------------------------- % 0050 % 0051 % --- inner_check_arguments() 0052 % 0053 function [EEGinfo, trans] = inner_check_arguments(EEGinfo, trans) 0054 func_ = mfilename; 0055 0056 vb_define_device; 0057 0058 if isempty(EEGinfo) 0059 error('(%s)EEGinfo is a required parameter', func_); 0060 end 0061 0062 if isempty(trans) 0063 trans = {EEG_TRIGGER_CHANNEL}; 0064 end 0065 % 0066 % --- end of inner_check_arguments() 0067 0068 %%% END OF FILE %%%