add item to history [USAGE] [obj] = history_add_item_varg(<obj>, <description>[,var1][,var2][,...]); [IN] obj : history object description : <<string>> explanation of history varargin : variable argument [OUT] obj : history object Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [obj] = history_add_item_varg(obj, description, varargin) 0002 % add item to history 0003 % [USAGE] 0004 % [obj] = history_add_item_varg(<obj>, <description>[,var1][,var2][,...]); 0005 % [IN] 0006 % obj : history object 0007 % description : <<string>> explanation of history 0008 % varargin : variable argument 0009 % [OUT] 0010 % obj : history object 0011 % 0012 % Copyright (C) 2011, ATR All Rights Reserved. 0013 % License : New BSD License(see VBMEG_LICENSE.txt) 0014 0015 % 0016 % --- Previous check 0017 % 0018 if ~exist('obj', 'var'), error('obj is a required parameter.'); end 0019 if ~exist('description', 'var'); 0020 error('description is a required parameter.'); 0021 end 0022 Nvarg = nargin - 2; 0023 for k=3:nargin 0024 if isempty(inputname(k)) 0025 error('Not variable was specified.'); 0026 end 0027 end 0028 0029 % 0030 % --- Main Procedure 0031 % 0032 S = struct; 0033 0034 for k=3:nargin 0035 S.(inputname(k)) = varargin{k-2}; 0036 end 0037 0038 obj = history_add_item(obj, description, S);