Home > functions > device > eeg > vb_eeginfo_get_channel_label_extra.m

vb_eeginfo_get_channel_label_extra

PURPOSE ^

return extra channel label list from EEGinfo struct

SYNOPSIS ^

function [ch_list] = vb_eeginfo_get_channel_label_extra(eeginfo, active_swt)

DESCRIPTION ^

 return extra channel label list from EEGinfo struct
 [usage]
   [ch_list] = vb_eeginfo_get_channel_label_extra(eeginfo, active_swt)
 [input]
   eeginfo : <required> <<struct>> EEGinfo
   active_swt : <optional> <<boolean>> [false]
              :   true) return only active channels (EEG)
              :  false) return all the channels (EEG)
 [output]
   ch_list : valid channel label list
 [note]
   .ExtraChannelInfo field keeps extra channels information
 [history]
   2008-02-27 (Sako) initial version
   2008-05-01 (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 [ch_list] = vb_eeginfo_get_channel_label_extra(eeginfo, active_swt)
0002 % return extra channel label list from EEGinfo struct
0003 % [usage]
0004 %   [ch_list] = vb_eeginfo_get_channel_label_extra(eeginfo, active_swt)
0005 % [input]
0006 %   eeginfo : <required> <<struct>> EEGinfo
0007 %   active_swt : <optional> <<boolean>> [false]
0008 %              :   true) return only active channels (EEG)
0009 %              :  false) return all the channels (EEG)
0010 % [output]
0011 %   ch_list : valid channel label list
0012 % [note]
0013 %   .ExtraChannelInfo field keeps extra channels information
0014 % [history]
0015 %   2008-02-27 (Sako) initial version
0016 %   2008-05-01 (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('eeginfo', 'var'), eeginfo = []; end
0023 if ~exist('active_swt', 'var'), active_swt = []; end
0024 [eeginfo, active_swt] = inner_check_arguments(eeginfo, active_swt);
0025 
0026 % --- MAIN PROCEDURE --------------------------------------------------------- %
0027 %
0028 if ~isfield(eeginfo, 'ExtraChannelInfo') ...
0029     || ~isfield(eeginfo.ExtraChannelInfo, 'Channel_name')
0030   ch_list = [];
0031 else
0032   ch_list = eeginfo.ExtraChannelInfo.Channel_name;
0033 end
0034 
0035 if isempty(ch_list) || ~active_swt
0036   return;
0037 end
0038 
0039 % ----- filter active channels
0040 if isfield(eeginfo.ExtraChannelInfo, 'Channel_active')
0041   active_list = eeginfo.ExtraChannelInfo.Channel_active;
0042   if length(ch_list) ~= length(active_list)
0043     fprintf('(%s) different length - channels and active list\n', mfilename);
0044     return;
0045   end
0046   ch_list = ch_list(active_list == 1);
0047 else
0048   fprintf('(%s) no active information for extra channel\n', mfilename);
0049 end
0050 return;
0051 %
0052 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0053 
0054 % --- INNER FUNCTIONS -------------------------------------------------------- %
0055 %
0056 function [eeginfo, active_swt] = inner_check_arguments(eeginfo, active_swt)
0057 func_ = mfilename;
0058 if isempty(eeginfo)
0059   error('(%s)eeginfo is a required parameter', func_);
0060 end
0061 
0062 if isempty(active_swt)
0063   active_swt = false;
0064 end
0065 return;
0066 %
0067 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0068 
0069 %%% END OF FILE %%%

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