Mercurial > hg > ltpda
comparison m-toolbox/classes/@pzmodel/attachToDom.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 | |
2 function collectedHist = attachToDom(objs, dom, parent, collectedHist) | |
3 | |
4 if isempty(objs) | |
5 | |
6 % Create empty pzmodel node with the attribute 'shape' | |
7 utils.xml.attachEmptyObjectNode(objs, dom, parent); | |
8 | |
9 else | |
10 for oo = 1:numel(objs) | |
11 obj = objs(oo); | |
12 | |
13 % Create object node | |
14 pzmodelNode = dom.createElement('pzmodel'); | |
15 pzmodelNode.setAttribute('shape', sprintf('%dx%d', size(objs))); | |
16 | |
17 % Call superclass | |
18 collectedHist = attachToDom@ltpda_tf(obj, dom, pzmodelNode, collectedHist); | |
19 | |
20 % Add poles | |
21 if isa(obj.poles, 'pz') | |
22 polesNode = dom.createElement('poles'); | |
23 collectedHist = obj.poles.attachToDom(dom, polesNode, collectedHist); | |
24 pzmodelNode.appendChild(polesNode); | |
25 end | |
26 | |
27 % Add zeros | |
28 if isa(obj.zeros, 'pz') | |
29 zerosNode = dom.createElement('zeros'); | |
30 collectedHist = obj.zeros.attachToDom(dom, zerosNode, collectedHist); | |
31 pzmodelNode.appendChild(zerosNode); | |
32 end | |
33 | |
34 % Add gain | |
35 gainNode = dom.createElement('gain'); | |
36 utils.xml.attachNumberToDom(obj.gain, dom, gainNode) | |
37 pzmodelNode.appendChild(gainNode); | |
38 | |
39 % Add delay | |
40 delayNode = dom.createElement('delay'); | |
41 utils.xml.attachNumberToDom(obj.delay, dom, delayNode) | |
42 pzmodelNode.appendChild(delayNode); | |
43 | |
44 % Add to parent node | |
45 parent.appendChild(pzmodelNode); | |
46 | |
47 end | |
48 end | |
49 | |
50 end |