Programatically Delete UITree Nodes in App Designer

17 ビュー (過去 30 日間)
Tom Hillman
Tom Hillman 2018 年 11 月 16 日
コメント済み: Tom Hillman 2018 年 11 月 23 日
In App Designer I have created a Tree structure and have programatically popoulated it with a 2-level heirarchy using the example code:
% First level nodes
category1 = uitreenode(t,'Text','Runners','NodeData',[]);
category2 = uitreenode(t,'Text','Cyclists','NodeData',[]);
% Second level nodes.
% Node data is age (y), height (m), weight (kg)
p1 = uitreenode(category1,'Text','Joe','NodeData',[40 1.67 58] );
p2 = uitreenode(category1,'Text','Linda','NodeData',[49 1.83 90]);
p3 = uitreenode(category2,'Text','Rajeev','NodeData',[25 1.47 53]);
p4 = uitreenode(category2,'Text','Anne','NodeData',[88 1.92 100]);
I need to update some of these categories and overwrite with new data. Is there any way to programatically clear the whole Tree structure or delete individual nodes? I can't find anything in the documentation that suggests this is possible.
Thanks,
Tom

採用された回答

Michael Kaiser
Michael Kaiser 2018 年 11 月 16 日
To delete all of the nodes and subnodes within tree t, delete(t.Children).
It is also possible to edit the properties of existing nodes, e.g. properties of category1
  1 件のコメント
Tom Hillman
Tom Hillman 2018 年 11 月 23 日
Thank you!
I thought it would be something obvious like this but hadn't tried that exact command on that property.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by