Home > vbmeg > functions > device > eeg > vb_eegfile_get_channel_label.m

vb_eegfile_get_channel_label

PURPOSE ^

return valid channel label list from eegfile

SYNOPSIS ^

function [ch_list] = vb_eegfile_get_channel_label(eegfile, active_swt, ch_type)

DESCRIPTION ^

 return valid channel label list from eegfile
 [usage]
   [channel_list] = vb_eegfile_get_channel_label(eegfile, active_swt, ch_type)
 [input]
       eegfile : <required> <<file>> EEG-MAT file
    active_swt : <optional> <<boolean>> [false] switch for active channel
               :   true) return only active channels (EEG)
               :  false) return all the channels (EEG)
       ch_type : <optional> [0] | 1 | 2
               :  0) all the channels
               :  1) only sensor channels (except for external channels)
               :  2) only external channels
 [output]
       ch_list : channel label list [N x 1]
 [note]
   @see vb_eeginfo_get_channel_label.m
 [history]
   2007-08-02 (Sako) initial version
   2008-05-01 (Sako) added active_swt
   2009-07-17 (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 [ch_list] = vb_eegfile_get_channel_label(eegfile, active_swt, ch_type)
0002 % return valid channel label list from eegfile
0003 % [usage]
0004 %   [channel_list] = vb_eegfile_get_channel_label(eegfile, active_swt, ch_type)
0005 % [input]
0006 %       eegfile : <required> <<file>> EEG-MAT file
0007 %    active_swt : <optional> <<boolean>> [false] switch for active channel
0008 %               :   true) return only active channels (EEG)
0009 %               :  false) return all the channels (EEG)
0010 %       ch_type : <optional> [0] | 1 | 2
0011 %               :  0) all the channels
0012 %               :  1) only sensor channels (except for external channels)
0013 %               :  2) only external channels
0014 % [output]
0015 %       ch_list : channel label list [N x 1]
0016 % [note]
0017 %   @see vb_eeginfo_get_channel_label.m
0018 % [history]
0019 %   2007-08-02 (Sako) initial version
0020 %   2008-05-01 (Sako) added active_swt
0021 %   2009-07-17 (Sako) added ch_type
0022 %
0023 % Copyright (C) 2011, ATR All Rights Reserved.
0024 % License : New BSD License(see VBMEG_LICENSE.txt)
0025 
0026 % --- CHECK ARGUMENTS --- %
0027 if ~exist('eegfile', 'var'), eegfile = []; end
0028 if ~exist('active_swt', 'var'), active_swt = []; end
0029 if ~exist('ch_type', 'var'), ch_type = []; end
0030 [eegfile, active_swt, ch_type] = ...
0031   inner_check_arguments(eegfile, active_swt, ch_type);
0032 
0033 
0034 % --- MAIN PROCEDURE --------------------------------------------------------- %
0035 %
0036 eeginfo = vb_eegfile_load_eeginfo(eegfile);
0037 
0038 % --- sensor channels
0039 if ch_type ~= 2
0040   eeg_ch = vb_eeginfo_get_channel_label(eeginfo, active_swt);
0041 else
0042   eeg_ch = {};
0043 end
0044 
0045 % --- external channels
0046 if ch_type ~= 1
0047   ext_ch = vb_eeginfo_get_channel_label_extra(eeginfo, active_swt);
0048 else
0049   ext_ch = {};
0050 end
0051 
0052 ch_list = [eeg_ch;ext_ch];
0053 
0054 % arrange to [N x 1]
0055 ch_list = vb_util_arrange_list(ch_list, 0);
0056 return;
0057 %
0058 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0059 
0060 % --- INNER FUNCTIONS -------------------------------------------------------- %
0061 %
0062 % --- inner_check_arguments()
0063 %
0064 function [eegfile, active_swt, ch_type] = ...
0065   inner_check_arguments(eegfile, active_swt, ch_type)
0066 func_ = mfilename;
0067 if isempty(eegfile)
0068   error('(%s)eegfile is a required parameter', func_);
0069 end
0070 
0071 if exist(eegfile, 'file') ~= 2
0072   error('(%s)cannot find eegfile : %s', func_, eegfile);
0073 end
0074 
0075 if isempty(active_swt)
0076   active_swt = false;
0077 end
0078 
0079 if isempty(ch_type)
0080   ch_type = 0;
0081 end
0082 return;
0083 %
0084 % --- end of inner_check_arguments()
0085 
0086 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0087 
0088 %%% END OF FILE %%%

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