allnodes
Tree nodes
Description
allnodes
is a tree management utility that returns one of
two node descriptions: either indices, or depths and positions.
Examples
Return Nodes of Wavelet Packet Tree
This example shows how to obtain the depth-position and linear indices of a wavelet packet tree.
Load the noisy Doppler signal and obtain the wavelet packet decomposition down to the level 4 using the db2
wavelet.
load noisdopp T = wpdec(noisdopp,4,"db2");
Obtain the depth-position indices.
DepthPosition = allnodes(T,"deppos");
Obtain the corresponding linear indices.
LinearIndices = allnodes(T);
Display the correspondence in a table.
table(DepthPosition,LinearIndices)
ans=31×2 table
DepthPosition LinearIndices
_____________ _____________
0 0 0
1 0 1
1 1 2
2 0 3
2 1 4
2 2 5
2 3 6
3 0 7
3 1 8
3 2 9
3 3 10
3 4 11
3 5 12
3 6 13
3 7 14
4 0 15
⋮
Input Arguments
T
— Tree
ntree
object | dtree
object | wptree
object
Tree, specified as a ntree
, dtree
, or
wptree
object.
Output Arguments
N
— Node description
vector | matrix
Node description, returned as a column vector or matrix. The nodes are numbered from left to right and top to bottom. The root index is 0.
If
,N
= allnodes(T)N
is a K-by-1 column vector, where K is the number of nodes in the tree.N(i)
is the index of the ith node.If
,N
= allnodes(T,"deppos")N
is a K-by-2 matrix.
is the depth andN
(i,1)N(i,2)
is the position of the ith node.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)