Documentation

This is machine translation

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

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

expand

(App Designer) Expand tree node

Use only for App Designer apps, or when creating apps with the uifigure function.

Syntax

expand(parent)
expand(parent,'all')

Description

expand(parent) expands the nodes of a tree or tree node. If parent is a Tree object, then the top-level nodes display in an expanded state. If parent is a TreeNode object, then that node displays in an expanded state.

example

expand(parent,'all') expands all nodes of a tree or tree node.

Examples

collapse all

Create a tree that has three levels of nodes. By default, the nodes display in a collapsed state.

f = uifigure;
tree = uitree(f,'Position',[20 20 175 100]);
    
% First level nodes
category1 = uitreenode(tree,'Text','Runners');
category2 = uitreenode(tree,'Text','Cyclists');

% Second level nodes
equip1 = uitreenode(category1,'Text','Equipment');
equip2 = uitreenode(category2,'Text','Equipment');
    
% Third level nodes
shoes = uitreenode(equip1,'Text','Running Shoes');
bike = uitreenode(equip2,'Text','Bicycle');
helmet = uitreenode(equip2,'Text','Helmet');

Expand the top-level nodes.

expand(tree)

Expand all the nodes in the tree.

expand(tree,'all')

Input Arguments

collapse all

Parent tree or node, specified as a Tree object or TreeNode object.

Introduced in R2017b

Was this topic helpful?