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.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
유럽
아시아 태평양
지역별 지사에 문의