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