Mercurial > hg > ltpda
view m-toolbox/classes/+utils/@helper/saveobj.m @ 52:daf4eab1a51e database-connection-manager tip
Fix. Default password should be [] not an empty string
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 07 Dec 2011 17:29:47 +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