sets precision field of saveman and returns the updated saveman [usage] [saveman] = vb_saveman_set_precision(saveman, prec) [input] saveman : <required> <<struct>> depot ship of 'dtype' prec : <optional> <<string>> precision [''] : e.g. 'float32' or 'float64' etc. : must be match with 'PRECISION' argument of fread [output] saveman : the newly updated saveman struct [note] this function does not check correctness this function does not automatically set default value [history] 2007-06-25 (Sako) initial version Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [saveman] = vb_saveman_set_precision(saveman, prec) 0002 % sets precision field of saveman and returns the updated saveman 0003 % [usage] 0004 % [saveman] = vb_saveman_set_precision(saveman, prec) 0005 % [input] 0006 % saveman : <required> <<struct>> depot ship of 'dtype' 0007 % prec : <optional> <<string>> precision [''] 0008 % : e.g. 'float32' or 'float64' etc. 0009 % : must be match with 'PRECISION' argument of fread 0010 % [output] 0011 % saveman : the newly updated saveman struct 0012 % [note] 0013 % this function does not check correctness 0014 % this function does not automatically set default value 0015 % [history] 0016 % 2007-06-25 (Sako) initial version 0017 % 0018 % Copyright (C) 2011, ATR All Rights Reserved. 0019 % License : New BSD License(see VBMEG_LICENSE.txt) 0020 0021 % --- CHECK ARGUMENTS --- % 0022 if ~exist('saveman', 'var'), saveman = []; end 0023 if ~exist('prec', 'var'), prec = ''; end 0024 [saveman, prec] = inner_check_arguments(saveman, prec); 0025 0026 % --- MAIN PROCEDURE --------------------------------------------------------- % 0027 % 0028 saveman.precision = prec; 0029 return; 0030 % 0031 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0032 0033 0034 % --- INNER FUNCTIONS -------------------------------------------------------- % 0035 % 0036 function [saveman, prec] = inner_check_arguments(saveman, prec) 0037 0038 func_ = 'vb_saveman_set_precision'; 0039 0040 if isempty(saveman) 0041 error('(%s)saveman is a required parameter', func_); 0042 end 0043 0044 if ~ischar(prec) 0045 error('(%s)precision must be <<string>> like ''float64''', func_); 0046 end 0047 return; 0048 % 0049 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0050 0051 % --- END OF FILE --- %