Display of trees
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.
indentdepth, <charlist>, <Small>>)
output::tree displays trees given as specially MuPAD® lists.
The first object of the list is the root of the tree. All further objects are nodes or subtrees of the tree. A subtree is again a special list (as described), and any other MuPAD object will be interpreted as node of the tree.
The elements of the tree will be printed by MuPAD, when the tree will be displayed, so it's recommended to use strings as objects or objects with a well defined display.
charlist is a list with five
characters. The default value is
["|", "+", "-", „",
" "]. The characters have the following meaning (described
in the order of the list).
The vertical lines of the tree, the connection between vertical and horizontal line (i.e., an arm, but not the last arm), an arm (vertical line), the last connection to an arm in a subtree, a char between an arm and the description of the arm.
output::tree displayes special nested lists
TREE := ["a1", "a2", ["b1", "b2", ["c1", "c2"], "b3"], ["d1", "d2", "d3"]]: print(Unquoted, output::tree(TREE))
a1 | +-- a2 | +-- b1 | | | +-- b2 | | | +-- c1 | | | | | `-- c2 | | | `-- b3 | `-- d1 | +-- d2 | `-- d3
print(Unquoted, output::tree(TREE, 3, Small)):
a1 +- a2 +- b1 | +- b2 | +- c1 | | `- c2 | `- b3 `- d1 +- d2 `- d3
The chars can be defined by the user:
print(Unquoted, output::tree(TREE, 6, ["|", "|", ".", "\\", " "])):
a1 | |.... a2 | |.... b1 | | | |.... b2 | | | |.... c1 | | | | | \.... c2 | | | \.... b3 | \.... d1 | |.... d2 | \.... d3
The tree, given as a special list
Indent depth for each subtree
The chars that illustrate the tree structure
Suppresses the display of a space line between every tree entry to reduce the height of the tree
String object to display