return switch ON (true) or OFF (false) to save [usage] [swt] = vb_saveman_get_switch(saveman) [input] saveman : <optional> <<struct>> specifications for saving : if this is empty, switch is OFF [output] swt : whether save or not (true or false) [note] if there is not switch field, determine 'ON' for now [history] 2007-05-17 (Sako) initial version 2011-07-06 (Sako) added empty check Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [swt] = vb_saveman_get_switch(saveman) 0002 % return switch ON (true) or OFF (false) to save 0003 % [usage] 0004 % [swt] = vb_saveman_get_switch(saveman) 0005 % [input] 0006 % saveman : <optional> <<struct>> specifications for saving 0007 % : if this is empty, switch is OFF 0008 % [output] 0009 % swt : whether save or not (true or false) 0010 % [note] 0011 % if there is not switch field, determine 'ON' for now 0012 % [history] 0013 % 2007-05-17 (Sako) initial version 0014 % 2011-07-06 (Sako) added empty check 0015 % 0016 % Copyright (C) 2011, ATR All Rights Reserved. 0017 % License : New BSD License(see VBMEG_LICENSE.txt) 0018 0019 if ~exist('saveman', 'var') || isempty(saveman) 0020 swt = false; 0021 return; 0022 end 0023 0024 if isfield(saveman, 'switch') 0025 swt = saveman.switch; 0026 else 0027 if isfield(saveman, 'data_dir') 0028 % if saveman does not have switch field, regard switch as ON 0029 swt = true; 0030 else 0031 swt = false; 0032 end 0033 end 0034 return; 0035 0036 % --- END OF FILE --- %