This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Node index to node depth-position


[D,P] = ind2depo(ORD,[D P])


ind2depo is a tree-management utility.

For a tree of order ORD, [D,P] = ind2depo(ORD,N) computes the depths D and the positions P (at these depths D) for the nodes with indices N.

The nodes are numbered from left to right and from top to bottom. The root index is 0.

N must be a column vector of integers (N ≥ 0).

Note that [D,P] = ind2depo(ORD,[D P]).


collapse all

Create a binary wavelet packet tree with three levels.

Ord = 2;
Lev = 3;
T = ntree(Ord,Lev);

Plot the binary wavelet packet tree.


Obtain the indices of the nodes in linear order.

idx = allnodes(T);

Conver the indices to depth-position format.

[depth,pos] = ind2depo(Ord,idx);
ans =

  15x2 table

    depth    pos
    _____    ___

    0        0  
    1        0  
    1        1  
    2        0  
    2        1  
    2        2  
    2        3  
    3        0  
    3        1  
    3        2  
    3        3  
    3        4  
    3        5  
    3        6  
    3        7  

See Also

Introduced before R2006a

Was this topic helpful?