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

vb_meginfo_get_channel_active_meg

PURPOSE ^

return active (valid) list of MEG channels

SYNOPSIS ^

function [active_list, result] =vb_meginfo_get_channel_active_meg(meg_info, active_swt)

DESCRIPTION ^

 return active (valid) list of MEG channels
 [usage]
   [active_list, result] = ...
     vb_meginfo_get_channel_active_meg(meg_info, active_swt)
 [input]
      meg_info : <required> <<struct>> MEGinfo which has ActiveChannel
    active_swt : <optional> <<boolean>> active filter switch [true]
               :   true) return as it is
               :  false) return the list all the channels are one
 [output]
   active_list : ExtraChannelInfo.Channel_active
        result : <<integer>> error code
               :  0) success
               :  1) error - bad MEGinfo
 [note]
   return value includes reference channels if exist
 [history]
   2008-08-25 (Sako) initial version

 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 [active_list, result] = ...
0002   vb_meginfo_get_channel_active_meg(meg_info, active_swt)
0003 % return active (valid) list of MEG channels
0004 % [usage]
0005 %   [active_list, result] = ...
0006 %     vb_meginfo_get_channel_active_meg(meg_info, active_swt)
0007 % [input]
0008 %      meg_info : <required> <<struct>> MEGinfo which has ActiveChannel
0009 %    active_swt : <optional> <<boolean>> active filter switch [true]
0010 %               :   true) return as it is
0011 %               :  false) return the list all the channels are one
0012 % [output]
0013 %   active_list : ExtraChannelInfo.Channel_active
0014 %        result : <<integer>> error code
0015 %               :  0) success
0016 %               :  1) error - bad MEGinfo
0017 % [note]
0018 %   return value includes reference channels if exist
0019 % [history]
0020 %   2008-08-25 (Sako) initial version
0021 %
0022 % Copyright (C) 2011, ATR All Rights Reserved.
0023 % License : New BSD License(see VBMEG_LICENSE.txt)
0024 
0025 % --- CHECK ARGUMENTS --- %
0026 if ~exist('meg_info', 'var'), meg_info = []; end
0027 if ~exist('active_swt', 'var'), active_swt = []; end
0028 [meg_info, active_swt, result] = inner_check_arguments(meg_info, active_swt);
0029 
0030 % --- MAIN PROCEDURE --------------------------------------------------------- %
0031 %
0032 active_list = [];
0033 if result ~= 0
0034   return;
0035 end
0036 
0037 active_list = vb_info_get_active_channel(meg_info);
0038 if ~active_swt
0039   % convert all elments one
0040   active_list = ones(length(active_list),1);
0041 end
0042 return;
0043 %
0044 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0045 
0046 % --- INNER FUNCTIONS -------------------------------------------------------- %
0047 %
0048 % --- inner_check_arguments()
0049 %
0050 function [meg_info, active_swt, result] = ...
0051   inner_check_arguments(meg_info, active_swt)
0052 func_ = mfilename;
0053 result = 0; % success
0054 
0055 if isempty(meg_info)
0056   fprintf('(%s)meg_info is a required parameter\n', func_);
0057   result = 1;
0058   return
0059 end
0060 
0061 if ~isfield(meg_info, 'ExtraChannelInfo')
0062   fprintf('(%s)meg_info must have ExtraChannelInfo field\n', func_);
0063   result = 1;
0064   return;
0065 end
0066 
0067 if isempty(active_swt)
0068   active_swt = true;
0069 end
0070 return;
0071 %
0072 % --- end of inner_check_arguments()
0073 %
0074 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0075 
0076 %%% END OF FILE %%%

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