return channel label list specified by channel type (integer) [usage] ch_label = vb_info_get_channel_label_by_type(info, ch_type) [input] info : <required> MEGinfo or EEGinfo ch_type : <optional> channel type [1] [output] ch_label : extracted channel label list {Nchannel x 1} [note] @see vb_info_get_channel_info.m [history] 2009-07-27 (Sako) initial version Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function ch_label = vb_info_get_channel_label_by_type(info, ch_type) 0002 % return channel label list specified by channel type (integer) 0003 % [usage] 0004 % ch_label = vb_info_get_channel_label_by_type(info, ch_type) 0005 % [input] 0006 % info : <required> MEGinfo or EEGinfo 0007 % ch_type : <optional> channel type [1] 0008 % [output] 0009 % ch_label : extracted channel label list {Nchannel x 1} 0010 % [note] 0011 % @see vb_info_get_channel_info.m 0012 % [history] 0013 % 2009-07-27 (Sako) initial version 0014 % 0015 % Copyright (C) 2011, ATR All Rights Reserved. 0016 % License : New BSD License(see VBMEG_LICENSE.txt) 0017 0018 % --- CHECK ARGUMENTS --- % 0019 if ~exist('info', 'var'), info = []; end 0020 if ~exist('ch_type', 'var'), ch_type = []; end 0021 [info, ch_type] = inner_check_arguments(info, ch_type); 0022 0023 % --- MAIN PROCEDURE --------------------------------------------------------- % 0024 % 0025 % --- get info of all channels 0026 ch_info = vb_info_get_channel_info(info, 2); 0027 0028 if isempty(ch_info) || ~isfield(ch_info, 'Type') || isempty(ch_info.Type) 0029 fprintf('(%s) ChannelInfo of this info does not have type list\n', ... 0030 mfilename); 0031 ch_label = {}; 0032 return; 0033 end 0034 0035 if ~isfield(ch_info, 'Name') || isempty(ch_info.Name) 0036 fprintf('(%s) ChannelInfo of this info does not have Name list\n', ... 0037 mfilename); 0038 ch_label = {}; 0039 return; 0040 end 0041 0042 ch_label = ch_info.Name(ch_info.Type == ch_type); 0043 return; 0044 % 0045 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0046 0047 % --- INNER FUNCTIONS -------------------------------------------------------- % 0048 % 0049 % --- inner_check_arguments() 0050 % 0051 function [info, ch_type] = inner_check_arguments(info, ch_type) 0052 func_ = mfilename; 0053 0054 if isempty(info) 0055 error('(%s) info is a required parameter', func_); 0056 end 0057 0058 if isempty(ch_type) 0059 ch_type = 1; 0060 end 0061 return; 0062 % 0063 % --- end of inner_check_arguments() 0064 % 0065 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0066 0067 % --- END OF FILE --- %