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