SAVE a history object to file. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: SAVE overloads the save method for history objects. CALL: Save a history object as a .mat file. >> save(h, 'blah.mat') Save a history object as an XML file. >> save(h, 'blah.xml') Save a history object to file specified in plist. >> save(h, plist) Parameters: 'filename' - name of the file VERSION: $Id: save.m,v 1.9 2007/07/12 15:54:42 ingo Exp $ The following call returns a parameter list object that contains the default parameter values: >> pl = save(history, 'Params') HISTORY: 28-08-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = save(varargin) 0002 0003 % SAVE a history object to file. 0004 % 0005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0006 % 0007 % DESCRIPTION: SAVE overloads the save method for history objects. 0008 % 0009 % CALL: Save a history object as a .mat file. 0010 % >> save(h, 'blah.mat') 0011 % Save a history object as an XML file. 0012 % >> save(h, 'blah.xml') 0013 % Save a history object to file specified in plist. 0014 % >> save(h, plist) 0015 % 0016 % Parameters: 'filename' - name of the file 0017 % 0018 % VERSION: $Id: save.m,v 1.9 2007/07/12 15:54:42 ingo Exp $ 0019 % 0020 % The following call returns a parameter list object that contains the 0021 % default parameter values: 0022 % 0023 % >> pl = save(history, 'Params') 0024 % 0025 % HISTORY: 28-08-07 M Hewitson 0026 % Creation 0027 % 0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0029 0030 % Check if this is a call for parameters 0031 if nargin == 2 0032 if isa(varargin{1}, 'history') && ischar(varargin{2}) 0033 in = char(varargin{2}); 0034 if strcmp(in, 'Params') 0035 varargout{1} = getDefaultPL(); 0036 return 0037 end 0038 end 0039 end 0040 0041 ALGONAME = mfilename; 0042 VERSION = '$Id: save.m,v 1.9 2007/07/12 15:54:42 ingo Exp $'; 0043 0044 if nargin ~= 2 0045 help mfilename; 0046 error('### incorrect inputs'); 0047 end 0048 0049 % get object 0050 obj = varargin{1}; 0051 if isa(varargin{2}, 'plist') 0052 pl = varargin{2}; 0053 elseif ischar(varargin{2}) 0054 pl = plist(param('filename', varargin{2})); 0055 else 0056 help mfilename; 0057 error('### incorrect inputs'); 0058 end 0059 0060 % Save object 0061 ltpda_saveobj(obj, pl); 0062 0063 % Get default params 0064 function plo = getDefaultPL() 0065 0066 disp('* creating default plist...'); 0067 plo = plist(); 0068 plo = append(plo, param('filename', 'object.xml')); 0069 disp('* done.'); 0070 0071 0072 % END