comparison m-toolbox/classes/@pest/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 pest 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 pestNode = dom.createElement('pest');
15 pestNode.setAttribute('shape', sprintf('%dx%d', size(objs)));
16
17 % Call superclass
18 collectedHist = attachToDom@ltpda_uoh(obj, dom, pestNode, collectedHist);
19
20 % Add dy
21 dyNode = dom.createElement('dy');
22 utils.xml.attachNumberToDom(obj.dy, dom, dyNode);
23 pestNode.appendChild(dyNode);
24
25 % Add y
26 yNode = dom.createElement('y');
27 utils.xml.attachNumberToDom(obj.y, dom, yNode);
28 pestNode.appendChild(yNode);
29
30 % Add names
31 content = dom.createTextNode(utils.xml.cellstr2str(obj.names));
32 namesNode = dom.createElement('names');
33 namesNode.appendChild(content);
34 pestNode.appendChild(namesNode);
35
36 % Add yunits
37 if isa(obj.yunits, 'unit')
38 yunitsNode = dom.createElement('yunits');
39 collectedHist = obj.yunits.attachToDom(dom, yunitsNode, collectedHist);
40 pestNode.appendChild(yunitsNode);
41 end
42
43 % Add pdf
44 pdfNode = dom.createElement('pdf');
45 utils.xml.attachNumberToDom(obj.pdf, dom, pdfNode);
46 pestNode.appendChild(pdfNode);
47
48 % Add cov
49 covNode = dom.createElement('cov');
50 utils.xml.attachNumberToDom(obj.cov, dom, covNode);
51 pestNode.appendChild(covNode);
52
53 % Add corr
54 corrNode = dom.createElement('corr');
55 utils.xml.attachNumberToDom(obj.corr, dom, corrNode);
56 pestNode.appendChild(corrNode);
57
58 % Add chi2
59 chi2Node = dom.createElement('chi2');
60 utils.xml.attachNumberToDom(obj.chi2, dom, chi2Node);
61 pestNode.appendChild(chi2Node);
62
63 % Add dof
64 dofNode = dom.createElement('dof');
65 utils.xml.attachNumberToDom(obj.dof, dom, dofNode);
66 pestNode.appendChild(dofNode);
67
68 % Add chain
69 chainNode = dom.createElement('chain');
70 utils.xml.attachNumberToDom(obj.chain, dom, chainNode);
71 pestNode.appendChild(chainNode);
72
73 % Add models
74 if isa(obj.models, 'ltpda_obj')
75 modelsNode = dom.createElement('models');
76 collectedHist = obj.models.attachToDom(dom, modelsNode, collectedHist);
77 pestNode.appendChild(modelsNode);
78 end
79
80 % Add to parent node
81 parent.appendChild(pestNode);
82
83 end
84 end
85
86 end