Home > functions > device > meg > vb_meginfo_get_channel_label_meg.m

vb_meginfo_get_channel_label_meg

PURPOSE ^

get channel label list from MEGinfo and return it

SYNOPSIS ^

function [label_list] = vb_meginfo_get_channel_label_meg(meginfo, active_swt)

DESCRIPTION ^

 get channel label list from MEGinfo and return it
 [usage]
   [label_list] = vb_meginfo_get_channel_label_meg(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]
   2007-05-25 (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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [label_list] = vb_meginfo_get_channel_label_meg(meginfo, active_swt)
0002 % get channel label list from MEGinfo and return it
0003 % [usage]
0004 %   [label_list] = vb_meginfo_get_channel_label_meg(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 %   2007-05-25 (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('meginfo', 'var'), meginfo = []; end
0023 if ~exist('active_swt', 'var'), active_swt = []; end
0024 [meginfo, active_swt] = inner_check_arguments(meginfo, active_swt);
0025 
0026 % --- MAIN PROCEDURE --------------------------------------------------------- %
0027 %
0028 label_list = meginfo.MEGch_name;
0029 if isempty(label_list)
0030   return;
0031 end
0032 
0033 if ~active_swt
0034   return;
0035 end
0036 
0037 active_list = vb_info_get_active_channel(meginfo);
0038 if length(active_list) ~= length(label_list)
0039   fprintf('(%s) different length - active list and label list\n', mfilename);
0040   return;
0041 end
0042 label_list = label_list(active_list == 1);
0043 return;
0044 %
0045 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0046 
0047 % --- INNER FUNCTIONS -------------------------------------------------------- %
0048 %
0049 % --- inner_check_arguments()
0050 %
0051 function [meginfo, active_swt] = inner_check_arguments(meginfo, active_swt)
0052 func_ = mfilename;
0053 if isempty(meginfo)
0054   error('(%s)meginfo is a required parameter', func_);
0055 end
0056 
0057 if ~isfield(meginfo, 'MEGch_name')
0058   error('(%s)MEGch_name is a required field of MEGinfo', func_);  
0059 end
0060 
0061 if ~vb_info_active_channel_is_valid(meginfo)
0062   active_swt = false;
0063 elseif isempty(active_swt)
0064   active_swt = false;
0065 end
0066 return;
0067 %
0068 % --- end of inner_check_arguments()
0069 %
0070 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0071 
0072 %%% END OF FILE %%%

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