Mercurial > hg > ltpda
comparison m-toolbox/classes/@tsdata/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 tsdata 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 tsdataNode = dom.createElement('tsdata'); | |
15 tsdataNode.setAttribute('shape', sprintf('%dx%d', size(objs))); | |
16 | |
17 % Call superclass | |
18 collectedHist = attachToDom@data2D(obj, dom, tsdataNode, collectedHist); | |
19 | |
20 % Add t0 | |
21 if isa(obj.t0, 'time') | |
22 childNode = dom.createElement('t0'); | |
23 | |
24 % We keep the meaning of t0 for backwars compatibility. This means | |
25 % - before saving, t0 = t0 + toffset | |
26 % - after loading, t0 = t0 - toffset | |
27 newT0 = obj.t0 + obj.toffset/1e3; | |
28 | |
29 collectedHist = newT0.attachToDom(dom, childNode, collectedHist); | |
30 tsdataNode.appendChild(childNode); | |
31 end | |
32 | |
33 % Add toffset | |
34 childNode = dom.createElement('toffset'); | |
35 utils.xml.attachNumberToDom(obj.toffset, dom, childNode) | |
36 tsdataNode.appendChild(childNode); | |
37 | |
38 % Add fs | |
39 childNode = dom.createElement('fs'); | |
40 utils.xml.attachNumberToDom(obj.fs, dom, childNode) | |
41 tsdataNode.appendChild(childNode); | |
42 | |
43 % Add nsecs | |
44 childNode = dom.createElement('nsecs'); | |
45 utils.xml.attachNumberToDom(obj.nsecs, dom, childNode) | |
46 tsdataNode.appendChild(childNode); | |
47 | |
48 % Add to parent node | |
49 parent.appendChild(tsdataNode); | |
50 | |
51 end | |
52 end | |
53 | |
54 end |