Home > classes > @pzmodel > xmladd.m

xmladd

PURPOSE ^

XMLADD add a pzmodel object to the given node of the input XML DOM

SYNOPSIS ^

function xml = xmladd(ps, xml, nodename, node)

DESCRIPTION ^

 XMLADD add a pzmodel object to the given node of the input XML DOM
 object.
 
 M Hewitson 14-02-07
 
 $Id: xml_add_pzmodel.m,v 1.2 2007/07/30 12:13:10 ingo Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function xml = xmladd(ps, xml, nodename, node)
0002 
0003 % XMLADD add a pzmodel object to the given node of the input XML DOM
0004 % object.
0005 %
0006 % M Hewitson 14-02-07
0007 %
0008 % $Id: xml_add_pzmodel.m,v 1.2 2007/07/30 12:13:10 ingo Exp $
0009 %
0010 
0011 el = xml.docNode.createElement(nodename);
0012 
0013 for j=1:length(ps)
0014   p = ps(j);
0015   
0016   elc = xml.docNode.createElement('pzmodel');
0017 
0018   % Add gain, poles, zeros
0019 
0020   % add name
0021   elcc = xml.docNode.createElement('name');
0022   elcc.appendChild(xml.docNode.createTextNode(get(p,'name')));
0023   elc.appendChild(elcc);
0024 
0025   % add gain
0026   elcc = xml.docNode.createElement('gain');
0027   elcc.appendChild(xml.docNode.createTextNode(ltpda_mat2str(get(p,'gain'))));
0028   elc.appendChild(elcc);
0029 
0030   % add poles
0031   ps = get(p,'poles');
0032   if ~isempty(ps)
0033     xml = xmladd(ps, xml, 'poles', elc);
0034   end
0035   
0036   % add zeros
0037   ps = get(p,'zeros');
0038   if ~isempty(ps)
0039       xml = xmladd(ps, xml, 'zeros', elc);  
0040   end
0041   el.appendChild(elc);
0042 end
0043 
0044 node.appendChild(el);
0045 
0046 
0047 
0048 % END

Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003