return channel label list from EEGinfo struct [usage] [ch_list] = vb_eeginfo_get_channel_label(eeginfo, active_swt) [input] eeginfo : <required> <<struct>> EEGinfo active_swt : <optional> <<boolean>> [false] : true) return only active channels (EEG) : false) return all the channels (EEG) [output] ch_list : valid channel label list [note] .ChannelName field keeps eeg sensor channel, not extra channels [history] 2008-02-26 (Sako) initial version 2008-04-14 (Sako) added active_swt Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [ch_list] = vb_eeginfo_get_channel_label(eeginfo, active_swt) 0002 % return channel label list from EEGinfo struct 0003 % [usage] 0004 % [ch_list] = vb_eeginfo_get_channel_label(eeginfo, active_swt) 0005 % [input] 0006 % eeginfo : <required> <<struct>> EEGinfo 0007 % active_swt : <optional> <<boolean>> [false] 0008 % : true) return only active channels (EEG) 0009 % : false) return all the channels (EEG) 0010 % [output] 0011 % ch_list : valid channel label list 0012 % [note] 0013 % .ChannelName field keeps eeg sensor channel, not extra channels 0014 % [history] 0015 % 2008-02-26 (Sako) initial version 0016 % 2008-04-14 (Sako) added active_swt 0017 % 0018 % Copyright (C) 2011, ATR All Rights Reserved. 0019 % License : New BSD License(see VBMEG_LICENSE.txt) 0020 0021 % --- CHECK ARGUMENTS --- % 0022 if ~exist('eeginfo', 'var'), eeginfo = []; end 0023 if ~exist('active_swt', 'var'), active_swt = []; end 0024 [eeginfo, active_swt] = inner_check_arguments(eeginfo, active_swt); 0025 0026 % --- MAIN PROCEDURE --------------------------------------------------------- % 0027 % 0028 if ~isfield(eeginfo, 'ChannelName') 0029 ch_list = []; 0030 return; 0031 else 0032 ch_list = eeginfo.ChannelName; 0033 end 0034 0035 if ~active_swt 0036 return; 0037 end 0038 0039 active_list = vb_info_get_active_channel(eeginfo); 0040 0041 if length(active_list) ~= length(ch_list) 0042 fprintf('(%s) different length - active list and channel list\n', ... 0043 mfilename); 0044 return; 0045 end 0046 ch_list = ch_list(active_list == 1); 0047 return; 0048 % 0049 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0050 0051 % --- INNER FUNCTIONS -------------------------------------------------------- % 0052 % 0053 function [eeginfo, active_swt] = inner_check_arguments(eeginfo, active_swt) 0054 func_ = mfilename; 0055 if isempty(eeginfo) 0056 error('(%s)eeginfo is a required parameter', func_); 0057 end 0058 0059 if ~vb_info_active_channel_is_valid(eeginfo) 0060 active_swt = false; 0061 elseif isempty(active_swt) 0062 active_swt = false; 0063 end 0064 return; 0065 % 0066 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0067 0068 %%% END OF FILE %%%