Home > vbmeg > functions > device > meg > vb_meginfo_get_channel_number_meg.m

vb_meginfo_get_channel_number_meg

PURPOSE ^

get number of meg channel from MEGinfo struct and return it

SYNOPSIS ^

function Nchannel = vb_meginfo_get_channel_number_meg(meginfo, active_swt)

DESCRIPTION ^

 get number of meg channel from MEGinfo struct and return it
 [usage]
   Nchannel = vb_meginfo_get_channel_number_meg(meginfo, active_swt)
 [input]
    meginfo : <required> <<struct>> MEG information
   active_swt : <optional> <<boolean>> return switch [false]
              :   true) return number of only active channels
              :  false) return number of all the channels
 [output]
   Nchannel : number of meg channel
 [note]
   
 [history]
   2007-06-19 (Sako) initial version
   2008-02-08 (Sako) modified according to new spec
   2008-04-15 (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 Nchannel = vb_meginfo_get_channel_number_meg(meginfo, active_swt)
0002 % get number of meg channel from MEGinfo struct and return it
0003 % [usage]
0004 %   Nchannel = vb_meginfo_get_channel_number_meg(meginfo, active_swt)
0005 % [input]
0006 %    meginfo : <required> <<struct>> MEG information
0007 %   active_swt : <optional> <<boolean>> return switch [false]
0008 %              :   true) return number of only active channels
0009 %              :  false) return number of all the channels
0010 % [output]
0011 %   Nchannel : number of meg channel
0012 % [note]
0013 %
0014 % [history]
0015 %   2007-06-19 (Sako) initial version
0016 %   2008-02-08 (Sako) modified according to new spec
0017 %   2008-04-15 (Sako) added active_swt
0018 %
0019 % Copyright (C) 2011, ATR All Rights Reserved.
0020 % License : New BSD License(see VBMEG_LICENSE.txt)
0021 
0022 % --- CHECK ARGUMENTS --- %
0023 if ~exist('meginfo', 'var'), meginfo = []; end
0024 if ~exist('active_swt', 'var'), active_swt = []; end
0025 [meginfo, active_swt] = inner_check_arguments(meginfo, active_swt);
0026 
0027 % --- MAIN PROCEDURE --------------------------------------------------------- %
0028 %
0029 
0030 if ~vb_info_active_channel_is_valid(meginfo)
0031   Nchannel = length(meginfo.MEGch_name);
0032   return;
0033 end
0034 
0035 if ~active_swt
0036   Nchannel = length(meginfo.MEGch_name);
0037   return;
0038 end
0039 
0040 active_list = vb_info_get_active_channel(meginfo);
0041 Nchannel = length(find(active_list==1));
0042 return;
0043 %
0044 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0045 
0046 % --- INNER FUNCTIONS -------------------------------------------------------- %
0047 %
0048 % --- inner_check_arguments()
0049 %
0050 function [meginfo, active_swt] = inner_check_arguments(meginfo, active_swt)
0051 func_ = mfilename;
0052 
0053 if isempty(meginfo)
0054   error('(%s)meginfo is a required parameter', func_);
0055 end
0056 
0057 if ~isfield(meginfo, 'MEGch_name');
0058   meginfo.MEGch_name = [];
0059 end
0060 
0061 if isempty(active_swt)
0062   active_swt = false;
0063 end
0064 return;
0065 %
0066 % --- end of inner_check_arguments()
0067 
0068 %
0069 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0070 
0071 %%% END OF FILE %%%

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005