Home > functions > common > loadfunc > vb_load_eeg_sensor.m

vb_load_eeg_sensor

PURPOSE ^

return coordinates of sensors from EEG-MAT file

SYNOPSIS ^

function [sensor, center, result] = vb_load_eeg_sensor(eegfile, active_swt)

DESCRIPTION ^

 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 swith 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
 [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

 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 [sensor, center, result] = 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 swith 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 % [note]
0021 %
0022 % [history]
0023 %   2006-12-11 (Sako) initial version
0024 %   2008-04-16 (Sako) added active_swt and rewrote
0025 %   2010-10-22 (Sako) modified help - output > sensor
0026 %   2011-06-01 (Sako) converted return values of vb_load_device to upper case
0027 %
0028 % Copyright (C) 2011, ATR All Rights Reserved.
0029 % License : New BSD License(see VBMEG_LICENSE.txt)
0030 
0031 % --- CHECK ARGUMENTS --- %
0032 if ~exist('eegfile', 'var'), eegfile = ''; end
0033 if ~exist('active_swt', 'var'), active_swt = []; end
0034 [eegfile, active_swt] = inner_check_arguments(eegfile, active_swt);
0035 
0036 % --- MAIN PROCEDURE --------------------------------------------------------- %
0037 %
0038 func_ = mfilename;
0039 
0040 sensor = [];
0041 center = [];
0042 
0043 if isempty(eegfile)
0044   fprintf('(%s)eegfile (%s) is invalid\n', func_, eegfile);
0045   result = 1;
0046   return;
0047 end
0048 
0049 [measurement] = vb_load_device(eegfile);
0050 Measurement = upper(measurement);
0051 
0052 if ~strcmp(Measurement, 'EEG')
0053   fprintf('(%s) ERROR: %s is not eeg data file\n', func_, eegfile);
0054   result = 2;
0055   return;
0056 end
0057 
0058 EEGinfo = vb_load_measurement_info(eegfile);
0059 [sensor, center, result] = vb_eeginfo_get_sensor_position(EEGinfo, active_swt);
0060 return;
0061 %
0062 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0063 
0064 % --- INNER FUNCTIONS -------------------------------------------------------- %
0065 %
0066 % --- inner_check_arguments()
0067 %
0068 function [eegfile, active_swt] = inner_check_arguments(eegfile, active_swt)
0069 if isempty(eegfile)
0070   eegfile = '';
0071 end
0072 
0073 if isempty(active_swt)
0074   active_swt = false;
0075 end
0076 return;
0077 %
0078 % --- end of inner_check_arguments()
0079 %
0080 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0081 
0082 % --- END OF FILE --- %

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