Mercurial > hg > ltpda
comparison m-toolbox/classes/@tsdata/fromDom.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 obj = fromDom(obj, node, inhists) | |
3 | |
4 % Get shape | |
5 objShape = utils.xml.getShape(node); | |
6 | |
7 if any(objShape==0) | |
8 | |
9 obj = tsdata.initObjectWithSize(objShape(1), objShape(2)); | |
10 | |
11 else | |
12 | |
13 %%%%%%%%%% Call super-class | |
14 | |
15 fromDom@data2D(obj, node, inhists); | |
16 | |
17 %%%%%%%%%% Get properties from the node attributes | |
18 | |
19 %%%%%%%%%% Get properties from the child nodes | |
20 | |
21 % Get t0 | |
22 childNode = utils.xml.getChildByName(node, 't0'); | |
23 if ~isempty(childNode) | |
24 | |
25 t0 = utils.xml.getObject(childNode, inhists); | |
26 | |
27 % We keep the meaning of t0 for backwars compatibility. This means | |
28 % - before saving, t0 = t0 + toffset | |
29 % - after loading, t0 = t0 - toffset | |
30 offsetNode = utils.xml.getChildByName(node, 'toffset'); | |
31 if ~isempty(offsetNode) | |
32 offset = utils.xml.getNumber(offsetNode); | |
33 t0 = t0 - offset/1e3; | |
34 end | |
35 | |
36 obj.t0 = t0; | |
37 end | |
38 | |
39 % Get toffset | |
40 childNode = utils.xml.getChildByName(node, 'toffset'); | |
41 if ~isempty(childNode) | |
42 obj.toffset = utils.xml.getNumber(childNode); | |
43 end | |
44 | |
45 % Get fs | |
46 childNode = utils.xml.getChildByName(node, 'fs'); | |
47 if ~isempty(childNode) | |
48 obj.fs = utils.xml.getNumber(childNode); | |
49 end | |
50 | |
51 % Get nsecs | |
52 childNode = utils.xml.getChildByName(node, 'nsecs'); | |
53 if ~isempty(childNode) | |
54 obj.nsecs = utils.xml.getNumber(childNode); | |
55 end | |
56 | |
57 end | |
58 | |
59 end | |
60 |