collapse
折叠树节点
说明
示例
折叠顶层节点
创建具有三级节点的树,并展开所有节点。
fig = uifigure; tree = uitree(fig,'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 all nodes expand(tree,'all');
折叠顶层节点。
collapse(tree)
展开 Cyclists 节点。
expand(category2)
Equipment 子节点已展开,因为之前的 collapse
命令仅折叠了 Cyclists 节点。如果要折叠所有子节点,请在调用 collapse
函数时指定 'all'
选项。
输入参数
parent
— 父级树或父级树节点
Tree
对象 | TreeNode
对象
父级树或父级树节点,指定为 Tree
对象或 TreeNode
对象。
版本历史记录
在 R2017b 中推出
另请参阅
expand
| move
| scroll
| uitree
| uitreenode
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)