get magz channel label list from MEGinfo and return it [usage] [label_list] = vb_meginfo_get_channel_label_magz(meginfo, active_swt) [input] meginfo : <required> <<struct>> MEG information active_swt : <optional> <<boolean>> [false] : true) return only active channel (MEG) : false) return all the channel (MEG) [output] label_list : channel label list [note] .MEGch_name field keeps meg channel name not extra nor reference [history] 2022-06-03 (k_suzuki) initial version based on vb_meginfo_get_channel_labe_meg Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [label_list] = vb_meginfo_get_channel_label_magz(meginfo, active_swt) 0002 % get magz channel label list from MEGinfo and return it 0003 % [usage] 0004 % [label_list] = vb_meginfo_get_channel_label_magz(meginfo, active_swt) 0005 % [input] 0006 % meginfo : <required> <<struct>> MEG information 0007 % active_swt : <optional> <<boolean>> [false] 0008 % : true) return only active channel (MEG) 0009 % : false) return all the channel (MEG) 0010 % [output] 0011 % label_list : channel label list 0012 % [note] 0013 % .MEGch_name field keeps meg channel name not extra nor reference 0014 % [history] 0015 % 2022-06-03 (k_suzuki) initial version based on vb_meginfo_get_channel_labe_meg 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('meginfo', 'var'), meginfo = []; end 0022 if ~exist('active_swt', 'var'), active_swt = []; end 0023 [meginfo, active_swt] = inner_check_arguments(meginfo, active_swt); 0024 0025 % --- MAIN PROCEDURE --------------------------------------------------------- % 0026 % 0027 TYPE_MAGZ = 6; 0028 label_list = meginfo.MEGch_name; 0029 magz_list = meginfo.ChannelInfo.Type==TYPE_MAGZ; 0030 if isempty(label_list) 0031 return; 0032 end 0033 0034 if ~active_swt 0035 label_list = label_list(magz_list); 0036 return; 0037 end 0038 0039 active_list = vb_info_get_active_channel(meginfo); 0040 if length(active_list) ~= length(label_list) 0041 fprintf('(%s) different length - active list and label list\n', mfilename); 0042 return; 0043 end 0044 label_list = label_list(active_list&magz_list); 0045 return; 0046 % 0047 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0048 0049 % --- INNER FUNCTIONS -------------------------------------------------------- % 0050 % 0051 % --- inner_check_arguments() 0052 % 0053 function [meginfo, active_swt] = inner_check_arguments(meginfo, active_swt) 0054 func_ = mfilename; 0055 if isempty(meginfo) 0056 error('(%s)meginfo is a required parameter', func_); 0057 end 0058 0059 if ~isfield(meginfo, 'MEGch_name') 0060 error('(%s)MEGch_name is a required field of MEGinfo', func_); 0061 end 0062 0063 if ~vb_info_active_channel_is_valid(meginfo) 0064 active_swt = false; 0065 elseif isempty(active_swt) 0066 active_swt = false; 0067 end 0068 return; 0069 % 0070 % --- end of inner_check_arguments() 0071 % 0072 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0073 0074 %%% END OF FILE %%%