MATLAB ヘルプ センター
Node index to node depth-position
[d,p] = ind2depo(ord,n)
ind2depo is a tree-management utility.
ind2depo
[d,p] = ind2depo(ord,n) returns, for a tree of order ord, the depths d and positions p (at those depths) for the nodes with indices n.
d,p
ord
n
d
p
The nodes are numbered from left to right and from top to bottom. The root index is 0.
example
collapse all
Create a binary wavelet packet tree with three levels.
Ord = 2; Lev = 3; T = ntree(Ord,Lev);
Plot the tree.
plot(T)
Use the allnodes function to obtain the indices of the nodes in linear order.
allnodes
idx = allnodes(T);
Convert the indices to depth-position format.
[depth,pos] = ind2depo(Ord,idx); table(idx,depth,pos)
ans = 15×3 table idx depth pos ___ _____ ___ 0 0 0 1 1 0 2 1 1 3 2 0 4 2 1 5 2 2 6 2 3 7 3 0 8 3 1 9 3 2 10 3 3 11 3 4 12 3 5 13 3 6 14 3 7
Order of a tree, specified as a positive integer.
Example: A binary tree is a tree of order 2.
Node indices, specified as a column vector with nonnegative integer entries.
Depths and positions (at those depths) for the nodes with indices n, returned as a pair of column vectors with nonnegative integer entries.
The values of the depths D and positions N are such that 0≤D and 0≤ P ≤ ordD-1.
Note
If n is a M-by-2 matrix, we have ind2depo(ord,n) = [n(:,1),n(:,2)].
ind2depo(ord,n) = [n(:,1),n(:,2)]
expand all
backgroundPool
ThreadPool
The ind2depo function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
You can use ind2depo in thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
depo2ind
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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
ヨーロッパ
アジア太平洋地域
最寄りの営業オフィスへのお問い合わせ