Home > functions > device > meg > vb_meginfo_get_channel_label_extra.m

vb_meginfo_get_channel_label_extra

PURPOSE ^

return label list of extra channel

SYNOPSIS ^

function [labels, result] =vb_meginfo_get_channel_label_extra(meginfo, active_swt, ref_swt)

DESCRIPTION ^

 return label list of extra channel
 [usage]
   [labels, result] = ...
      vb_meginfo_get_channel_label_extra(meginfo, active_swt, ref_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
      ref_swt : <optional> <<boolean>> switch to include reference or not
              :    true ) return list which includes reference channels
              :  [false]) return list no-reference channels
 [output]
       labels : label list of channels
       result : <<integer>> error code
              :  0) success
              :  1) error - bad meginfo
 [note]
   new ExtraChannelInfo
     .Channel_active
     .Channel_name
     .Channel_type
     .Channel_id
 [history]
   2007-06-27 (Sako) initial version
   2008-02-01 (Sako) modified according to new spec
   2008-04-21 (Sako) added active_swt, ref_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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

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

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005