return coordinates of sensors from EEG-MAT file [usage] [sensor, center, result] = vb_load_eeg_sensor(eegfile, active_swt) [input] eegfile : <required> <<file>> EEG-MAT file active_swt : <optional> <<boolean>> [false] switch to filter channel : true) return only active channels (MEG) : false) return all the channels (MEG) : only when mode is 'MEG', this switch is available [output] sensor : coordinates of sensors which are loaded from eegfile : [Nchannel x 3] center : coordinate of center point : [1 x 3] result : <<integer>> : 0) success : 1) error - bad eegfile : 2) error - not be EEG data channel_info : <<struct>> channel information of loaded data : .Active [Nchannel x 1] : .Name [Nchannel x 1] : .Type [Nchannel x 1] : .ID [Nchannel x 1] [note] [history] 2006-12-11 (Sako) initial version 2008-04-16 (Sako) added active_swt and rewrote 2010-10-22 (Sako) modified help - output > sensor 2011-06-01 (Sako) converted return values of vb_load_device to upper case 2017-03-06 (rhayashi) Add channel_info Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [sensor, center, result, channel_info] = vb_load_eeg_sensor(eegfile, active_swt) 0002 % return coordinates of sensors from EEG-MAT file 0003 % [usage] 0004 % [sensor, center, result] = vb_load_eeg_sensor(eegfile, active_swt) 0005 % [input] 0006 % eegfile : <required> <<file>> EEG-MAT file 0007 % active_swt : <optional> <<boolean>> [false] switch to filter channel 0008 % : true) return only active channels (MEG) 0009 % : false) return all the channels (MEG) 0010 % : only when mode is 'MEG', this switch is available 0011 % [output] 0012 % sensor : coordinates of sensors which are loaded from eegfile 0013 % : [Nchannel x 3] 0014 % center : coordinate of center point 0015 % : [1 x 3] 0016 % result : <<integer>> 0017 % : 0) success 0018 % : 1) error - bad eegfile 0019 % : 2) error - not be EEG data 0020 % channel_info : <<struct>> channel information of loaded data 0021 % : .Active [Nchannel x 1] 0022 % : .Name [Nchannel x 1] 0023 % : .Type [Nchannel x 1] 0024 % : .ID [Nchannel x 1] 0025 % [note] 0026 % 0027 % [history] 0028 % 2006-12-11 (Sako) initial version 0029 % 2008-04-16 (Sako) added active_swt and rewrote 0030 % 2010-10-22 (Sako) modified help - output > sensor 0031 % 2011-06-01 (Sako) converted return values of vb_load_device to upper case 0032 % 2017-03-06 (rhayashi) Add channel_info 0033 % 0034 % Copyright (C) 2011, ATR All Rights Reserved. 0035 % License : New BSD License(see VBMEG_LICENSE.txt) 0036 0037 % --- CHECK ARGUMENTS --- % 0038 if ~exist('eegfile', 'var'), eegfile = ''; end 0039 if ~exist('active_swt', 'var'), active_swt = []; end 0040 [eegfile, active_swt] = inner_check_arguments(eegfile, active_swt); 0041 0042 % --- MAIN PROCEDURE --------------------------------------------------------- % 0043 % 0044 func_ = mfilename; 0045 0046 sensor = []; 0047 center = []; 0048 channel_info = []; 0049 0050 if isempty(eegfile) 0051 fprintf('(%s)eegfile (%s) is invalid\n', func_, eegfile); 0052 result = 1; 0053 return; 0054 end 0055 0056 [measurement] = vb_load_device(eegfile); 0057 Measurement = upper(measurement); 0058 0059 if ~strcmp(Measurement, 'EEG') 0060 fprintf('(%s) ERROR: %s is not eeg data file\n', func_, eegfile); 0061 result = 2; 0062 return; 0063 end 0064 0065 EEGinfo = vb_load_measurement_info(eegfile); 0066 [sensor, center, result, channel_info] = vb_eeginfo_get_sensor_position(EEGinfo, active_swt); 0067 return; 0068 % 0069 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0070 0071 % --- INNER FUNCTIONS -------------------------------------------------------- % 0072 % 0073 % --- inner_check_arguments() 0074 % 0075 function [eegfile, active_swt] = inner_check_arguments(eegfile, active_swt) 0076 if isempty(eegfile) 0077 eegfile = ''; 0078 end 0079 0080 if isempty(active_swt) 0081 active_swt = false; 0082 end 0083 return; 0084 % 0085 % --- end of inner_check_arguments() 0086 % 0087 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0088 0089 % --- END OF FILE --- %