return label list of refference magnetometer channel [usage] [labels, result] = vb_meginfo_get_channel_label_refmg(meginfo, active_swt) [input] meginfo : <required> <<struct>> MEGinfo which has 'ExtraChannelInfo' active_swt : <optional> <<boolean>> active filter switch [false] : true) return active channels : false) return all the channels [output] labels : label list of channels result : <<integer>> error code : 0) success : 1) error - bad meginfo [note] refference magnetometer channel stood on its foot from extra channels if an appropriate field does not exist, return empty ([]). for only YOKOGAWA for now [history] 2007-06-27 (Sako) initial version 2008-02-01 (Sako) modified for new specification 2008-04-17 (Sako) added active_swt 2008-06-06 (Sako) modified by adding return condition Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [labels, result] = ... 0002 vb_meginfo_get_channel_label_refmg(meginfo, active_swt) 0003 % return label list of refference magnetometer channel 0004 % [usage] 0005 % [labels, result] = vb_meginfo_get_channel_label_refmg(meginfo, active_swt) 0006 % [input] 0007 % meginfo : <required> <<struct>> MEGinfo which has 'ExtraChannelInfo' 0008 % active_swt : <optional> <<boolean>> active filter switch [false] 0009 % : true) return active channels 0010 % : false) return all the channels 0011 % [output] 0012 % labels : label list of channels 0013 % result : <<integer>> error code 0014 % : 0) success 0015 % : 1) error - bad meginfo 0016 % [note] 0017 % refference magnetometer channel stood on its foot from extra channels 0018 % if an appropriate field does not exist, return empty ([]). 0019 % for only YOKOGAWA for now 0020 % [history] 0021 % 2007-06-27 (Sako) initial version 0022 % 2008-02-01 (Sako) modified for new specification 0023 % 2008-04-17 (Sako) added active_swt 0024 % 2008-06-06 (Sako) modified by adding return condition 0025 % 0026 % Copyright (C) 2011, ATR All Rights Reserved. 0027 % License : New BSD License(see VBMEG_LICENSE.txt) 0028 0029 % --- CHECK ARGUMENTS --- % 0030 if ~exist('meginfo', 'var'), meginfo = []; end 0031 if ~exist('active_swt', 'var'), active_swt = []; end 0032 [meginfo, active_swt, result] = inner_check_arguments(meginfo, active_swt); 0033 0034 % --- MAIN PROCEDURE --------------------------------------------------------- % 0035 % 0036 labels = []; 0037 if result ~= 0 0038 return; 0039 end 0040 0041 all_labels = meginfo.ExtraChannelInfo.Channel_name; 0042 if isempty(all_labels) 0043 return; 0044 end 0045 0046 % this rule is YOKOGAWA rule 0047 ch_type = vb_meginfo_get_channel_type_extra(meginfo); 0048 active_list = vb_meginfo_get_channel_active_extra(meginfo, active_swt); 0049 0050 if isempty(ch_type) || isempty(active_list) 0051 return; 0052 end 0053 0054 if length(active_list) ~= length(ch_type) 0055 fprintf('(%s) different length active list and channel type list\n', ... 0056 mfilename); 0057 labels = all_labels; 0058 return; 0059 end 0060 0061 % ----- channel type over zero means extra channel 0062 % ----- narrow by active filter and channel type 0063 criterion = bitand((active_list == 1),(ch_type > 0)); 0064 labels = all_labels(criterion == 1); 0065 return; 0066 % 0067 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0068 0069 % --- INNER FUNCTIONS -------------------------------------------------------- % 0070 % 0071 % --- inner_check_arguments() 0072 % 0073 function [meginfo, active_swt, result] = ... 0074 inner_check_arguments(meginfo, active_swt) 0075 0076 func_ = mfilename; 0077 result = 0; 0078 0079 if isempty(meginfo) 0080 fprintf('(%s)meginfo is a required parameter\n', func_); 0081 result = 1; 0082 return; 0083 end 0084 0085 % meginfo must have EEGinfo field 0086 if ~isfield(meginfo, 'ExtraChannelInfo') || isempty(meginfo.ExtraChannelInfo) 0087 fprintf('(%s)meginfo must have ExtraChannelInfo field\n', func_); 0088 result = 1; 0089 return; 0090 end 0091 0092 if isempty(active_swt) 0093 active_swt = false; 0094 end 0095 return; 0096 % 0097 % --- end of inner_check_arguments() 0098 % 0099 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0100 0101 %%% END OF FILE %%%