Last change
on this file since 731 was
723,
checked in by sommeria, 11 years ago
|
xmltree and toolbox_calib added to svn
|
File size:
915 bytes
|
Line | |
---|
1 | function l = length(tree,r) |
---|
2 | % XMLTREE/LENGTH Length Method |
---|
3 | % FORMAT l = length(tree,r) |
---|
4 | % |
---|
5 | % tree - XMLTree object |
---|
6 | % r - 'real' if present, returns the real number of nodes in the |
---|
7 | % tree (deleted nodes aren't populated) |
---|
8 | % l - length of the XML tree (number of nodes) |
---|
9 | %_______________________________________________________________________ |
---|
10 | % |
---|
11 | % Return the number of nodes of an XMLTree object. |
---|
12 | %_______________________________________________________________________ |
---|
13 | % @(#)length.m Guillaume Flandin 02/03/27 |
---|
14 | |
---|
15 | error(nargchk(1,2,nargin)); |
---|
16 | |
---|
17 | % Return the full number of nodes once allocated |
---|
18 | l = length(tree.tree); |
---|
19 | |
---|
20 | % Substract the number of deleted nodes to the previous length |
---|
21 | if nargin == 2 |
---|
22 | if strcmp(r,'real') |
---|
23 | ll = 0; |
---|
24 | for i=1:l |
---|
25 | if ~strcmp(tree.tree{i}.type,'deleted') |
---|
26 | ll = ll + 1; |
---|
27 | end |
---|
28 | end |
---|
29 | l = ll; |
---|
30 | else |
---|
31 | error('[XMLTree] Bad input argument.'); |
---|
32 | end |
---|
33 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.