This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Visualize an expression as tree

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


prog::exprtree(ex, <Quiet>)


prog::exprtree(ex) visualizes any MuPAD® expression ex as tree.

Every expression in MuPAD is internally a tree. The operations are the nodes, and the operands are the leafs.


Example 1

The example shows the structure of the expression a + b*2 - d*(a + c):

prog::exprtree(a + b*2 - d*(a + c))
+-- a
+-- _mult
|   |
|   +-- b
|   |
|   `-- 2
`-- _mult
    +-- d
    +-- _plus
    |   |
    |   +-- a
    |   |
    |   `-- c
    `-- -1

Tree1 is the return value of type adt::Tree. This object can be exposed or taken for other operations.

The option Quiet suppresses the output, only the tree is returned:

prog::exprtree(a + b*2 - d*(a + c), Quiet)



Expression to visualize



With this option no output will be printed on screen. The return value of type adt::Tree represents the tree structure of ex.

Return Values

Object of type adt::Tree

See Also

MuPAD Functions

Was this topic helpful?