Return Measurement and device from meg_parm. [USAGE] [Measurement, Device] = vb_meg_parm_get_measurement(<meg_parm>); [IN] meg_parm : meg_parm for device. [OUT] Measurement : Measurement type Device : device type [NOTE] @see : vb_meg_parm_set_measurement() If Measurement or device fields do not exists(or empty), this function starts deciding Measurement and device. But it failed, return empty. Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [Measurement, Device] = vb_meg_parm_get_measurement(meg_parm) 0002 % Return Measurement and device from meg_parm. 0003 % [USAGE] 0004 % [Measurement, Device] = vb_meg_parm_get_measurement(<meg_parm>); 0005 % [IN] 0006 % meg_parm : meg_parm for device. 0007 % [OUT] 0008 % Measurement : Measurement type 0009 % Device : device type 0010 % [NOTE] 0011 % @see : vb_meg_parm_set_measurement() 0012 % If Measurement or device fields do not exists(or empty), 0013 % this function starts deciding Measurement and device. 0014 % But it failed, return empty. 0015 % 0016 % Copyright (C) 2011, ATR All Rights Reserved. 0017 % License : New BSD License(see VBMEG_LICENSE.txt) 0018 0019 % 0020 % --- Previous check 0021 % 0022 if ~exist('meg_parm', 'var') 0023 error('meg_parm is a required parameter.'); 0024 end 0025 0026 % 0027 % --- Main Procedure 0028 % 0029 Measurement = ''; 0030 Device = ''; 0031 0032 if isfield(meg_parm, 'Measurement') && ~isempty(meg_parm.Measurement) 0033 Measurement = meg_parm.Measurement; 0034 end 0035 if isfield(meg_parm, 'device') && ~isempty(meg_parm.device) 0036 Device = meg_parm.device; 0037 end 0038 0039 if ~isempty(Measurement) && ~isempty(Device) 0040 return; 0041 end 0042 0043 % rescue start 0044 if isfield(meg_parm, 'yokogawa_file') 0045 Measurement = 'MEG'; 0046 Device = 'YOKOGAWA'; 0047 elseif isfield(meg_parm, 'sbi_file') 0048 Measurement = 'MEG'; 0049 Device = 'SBI'; 0050 elseif isfield(meg_parm, 'measurement_file') 0051 Measurement = 'EEG'; 0052 Device = 'BIOSEMI'; 0053 else 0054 % do nothing (return empty) 0055 end