Home > classes > @pzmodel > save.m

save

PURPOSE ^

SAVE a pzmodel object to file.

SYNOPSIS ^

function varargout = save(varargin)

DESCRIPTION ^

 SAVE a pzmodel object to file.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: SAVE overloads the save method for pzmodel objects.

 CALL:        Save a pzmodel object as a .mat file.
                >> save(pzm, 'blah.mat')
              Save a pzmodel object as an XML file.
                >> save(pzm, 'blah.xml')
              Save a pzmodel object to file specified in plist.
                >> save(pzm, plist)

 Parameters: 'filename' - name of the file

 VERSION:     $Id: save.m,v 1.4 2008/02/15 16:27:16 mauro Exp $

 The following call returns a parameter list object that contains the
 default parameter values:

 >> pl = save(pzmodel, 'Params')

 The following call returns a string that contains the routine CVS version:

 >> version = save(pzmodel, 'Version')

 The following call returns a string that contains the routine category:

 >> category = save(pzmodel, 'Category')

 HISTORY: 28-08-07 M Hewitson
             Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = save(varargin)
0002 % SAVE a pzmodel object to file.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: SAVE overloads the save method for pzmodel objects.
0007 %
0008 % CALL:        Save a pzmodel object as a .mat file.
0009 %                >> save(pzm, 'blah.mat')
0010 %              Save a pzmodel object as an XML file.
0011 %                >> save(pzm, 'blah.xml')
0012 %              Save a pzmodel object to file specified in plist.
0013 %                >> save(pzm, plist)
0014 %
0015 % Parameters: 'filename' - name of the file
0016 %
0017 % VERSION:     $Id: save.m,v 1.4 2008/02/15 16:27:16 mauro Exp $
0018 %
0019 % The following call returns a parameter list object that contains the
0020 % default parameter values:
0021 %
0022 % >> pl = save(pzmodel, 'Params')
0023 %
0024 % The following call returns a string that contains the routine CVS version:
0025 %
0026 % >> version = save(pzmodel, 'Version')
0027 %
0028 % The following call returns a string that contains the routine category:
0029 %
0030 % >> category = save(pzmodel, '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:16 mauro Exp $';
0039 CATEGORY = 'Output';
0040 
0041 % Check if this is a call for parameters
0042 if nargin == 2
0043   if isa(varargin{1}, 'pzmodel') && 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

Generated on Mon 31-Mar-2008 13:54:54 by m2html © 2003