confirm whether meg_info has sensor_weight_ref field field or not [usage] [result] = vb_meginfo_sensor_weight_refmg_exist(meg_info) [input] meg_info : <required> <<struct>> MEGinfo [output] result : <<boolean>> : true ) meg_info has the 'sensor_weight_ref' field : flase) meg_info does not have the 'sensor_weight_ref' field [note] The field is "MEGinfo.device_info.sensor_weight_ref". [history] 2011-07-20 (Sako) initial version
0001 function [result] = vb_meginfo_sensor_weight_refmg_exist(meg_info) 0002 % confirm whether meg_info has sensor_weight_ref field field or not 0003 % [usage] 0004 % [result] = vb_meginfo_sensor_weight_refmg_exist(meg_info) 0005 % [input] 0006 % meg_info : <required> <<struct>> MEGinfo 0007 % [output] 0008 % result : <<boolean>> 0009 % : true ) meg_info has the 'sensor_weight_ref' field 0010 % : flase) meg_info does not have the 'sensor_weight_ref' field 0011 % [note] 0012 % The field is "MEGinfo.device_info.sensor_weight_ref". 0013 % [history] 0014 % 2011-07-20 (Sako) initial version 0015 0016 % --- CHECK ARGUMENTS --- % 0017 if ~exist('meg_info', 'var'), meg_info = []; end 0018 [meg_info] = inner_check_arguments(meg_info); 0019 0020 % --- MAIN PROCEDURE --------------------------------------------------------- % 0021 % 0022 % --- Check point is only whether there is the field. 0023 0024 % --- old format 0025 if isfield(meg_info, 'sensor_weight_ref') 0026 warning('(%s) "MEGinfo.sensor_weight_ref" is old format\n', mfilename); 0027 result = true; 0028 return; 0029 end 0030 0031 result = false; 0032 if ~isfield(meg_info, 'device_info'), return; end 0033 if ~isfield(meg_info.device_info, 'sensor_weight_ref'), return; end 0034 if isempty(meg_info.device_info.sensor_weight_ref), return; end 0035 0036 result = true; 0037 return; 0038 % 0039 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0040 0041 % --- INNER FUNCTIONS -------------------------------------------------------- % 0042 % 0043 % --- inner_check_arguments() 0044 % 0045 function [meg_info] = inner_check_arguments(meg_info) 0046 func_ = mfilename; 0047 if isempty(meg_info) 0048 error('(%s) meg_info is a required parameter', func_); 0049 end 0050 return; 0051 % --- end of inner_check_arguments() 0052 % 0053 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0054 0055 % --- END OF FILE --- %