Documentation Center

  • Trial Software
  • Product Updates

prog::exprtree

Visualize an expression as tree

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

prog::exprtree(ex, <Quiet>)

Description

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.

Examples

Example 1

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

prog::exprtree(a + b*2 - d*(a + c))
_plus
|
+-- 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)

Parameters

ex

Expression to visualize

Options

Quiet

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?