Mercurial > hg > ltpda
view m-toolbox/classes/+utils/@helper/saveobj.m @ 49:0bcdf74587d1 database-connection-manager
Cleanup
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 07 Dec 2011 17:24:36 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
function varargout = saveobj(a, pl) % SAVEOBJ saves an object to a file. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: SAVEOBJ saves an object to a file. % % CALL: saveobj(obj, pl) % % INPUTS: obj - an object (for example, an AO) % pl - parameter list with a 'filename' parameter % % Supported file types are '.mat' and '.xml'. % % OUTPUTS: % % VERSION: $Id: saveobj.m,v 1.3 2010/09/17 14:12:31 ingo Exp $ % % HISTORY: 28-08-2007 M Hewitson % Creation % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % get filename filename = find(pl, 'filename'); % Inspect filename [path,name,ext] = fileparts(filename); switch ext case '.mat' save(filename, 'a'); case '.xml' % convert object to xml xml = com.mathworks.xml.XMLUtils.createDocument('ltpda_object'); parent = xml.getDocumentElement; utils.xml.xmlwrite(a, xml, parent, ''); % Save the XML document. xmlwrite(filename, xml); otherwise error('### unknown file extension.'); end