| Wavelet Toolbox | |
| Provide feedback about this page |
Syntax
Description
N = noleaves(T) returns the indices of nonterminal nodes of the tree T (i.e., nodes that are not leaves). N is a column vector.
The nodes are ordered from left to right as in tree T.
N = noleaves(T,'dp') returns a matrix N, which contains the depths and positions of nonterminal nodes.
N(i,1) is the depth of the i-th nonterminal node andN(i,2) is the position of the i-th nonterminal node.
Examples
% Create initial tree. ord = 2; t = ntree(ord,3); % binary tree of depth 3. t=nodejoin(t,5); t=nodejoin(t,4); plot(t) % Change Node Label from Depth_Position to Index % (see theplotfunction).% List nonterminal nodes (index). ntnodes_ind = noleaves(t) ntnodes_ind = 0 1 2 3 6 % List nonterminal nodes (Depth_Position). ntnodes_depo = noleaves(t,'dp') ntnodes_depo = 0 0 1 0 1 1 2 0 2 3
See Also
| Provide feedback about this page |
![]() | nodesplt | ntnode | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |