Home > functions > device > vb_info_get_active_channel.m

vb_info_get_active_channel

PURPOSE ^

<<getter>> return active channel field from MEGinfo or EEGinfo

SYNOPSIS ^

function [active_channel] = vb_info_get_active_channel(info, ch_type)

DESCRIPTION ^

 <<getter>> return active channel field from MEGinfo or EEGinfo
 [usage]
   [active_channel] = vb_info_get_active_channel(info, ch_type)
 [input]
             info : <required> <<struct>> MEGinfo or EEGinfo
          ch_type : <optional> <<integer>> channel type [1]
                  :  1) MEG or EEG channels
                  :  2) only extra channels
                  :  3) all channels
 [output]
   active_channel : active channel field as it is
 [note]

 [history]
   2008-04-14 (Sako) initial version
   2008-06-05 (Sako) added ch_type

 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_channel] = vb_info_get_active_channel(info, ch_type)
0002 % <<getter>> return active channel field from MEGinfo or EEGinfo
0003 % [usage]
0004 %   [active_channel] = vb_info_get_active_channel(info, ch_type)
0005 % [input]
0006 %             info : <required> <<struct>> MEGinfo or EEGinfo
0007 %          ch_type : <optional> <<integer>> channel type [1]
0008 %                  :  1) MEG or EEG channels
0009 %                  :  2) only extra channels
0010 %                  :  3) all channels
0011 % [output]
0012 %   active_channel : active channel field as it is
0013 % [note]
0014 %
0015 % [history]
0016 %   2008-04-14 (Sako) initial version
0017 %   2008-06-05 (Sako) added ch_type
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('info', 'var'), info = []; end
0024 if ~exist('ch_type', 'var'), ch_type = []; end
0025 [info, ch_type] = inner_check_arguments(info, ch_type);
0026 
0027 % --- MAIN PROCEDURE --------------------------------------------------------- %
0028 %
0029 if ~isfield(info, 'ActiveChannel')
0030   active_channel = [];
0031   return;
0032 end
0033 
0034 switch ch_type
0035   case 1
0036     % MEG or EEG channels
0037     active_channel = info.ActiveChannel;
0038     return;
0039 
0040   case 2
0041     % only extra channels
0042     active_channel = info.ExtraChannelInfo.Channel_active;
0043     return;
0044     
0045   case 3
0046     % all channels
0047     active_channel = [info.ActiveChannel;info.ExtraChannelInfo.Channel_active];
0048     return;
0049 end
0050 return;
0051 %
0052 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0053 
0054 % --- INNER FUNCTIONS -------------------------------------------------------- %
0055 %
0056 % --- inner_check_arguments()
0057 %
0058 function [info, ch_type] = inner_check_arguments(info, ch_type)
0059 func_ = mfilename;
0060 if isempty(info)
0061   error('(%s)info is a required parameter', func_);
0062 end
0063 
0064 if isempty(ch_type)
0065   ch_type = 1;
0066 end
0067 return;
0068 %
0069 % --- end of inner_check_arguments()
0070 %
0071 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0072 
0073 %%% END OF FILE %%%

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