Clear Filters
Clear Filters

Copy nodes and sub-nodes of uitree to another uitree

11 views (last 30 days)
Hi,
I have two trees in app-designer and created some nodes and subnodes in one of them as follows:
for i=1:length(data1)
nodes(i) = uitreenode(tree1,'Text',data1(i));
subnodes(i) = uitreenode(nodes(i),'Text',data2(i));
end
Now I want to copy these nodes and subnodes to the second tree. I used:
Copyobj(nodes, tree2);
This works fine when the tree has no subnodes, but throw error for my case with subnodes.

Answers (1)

James Sweetman
James Sweetman on 2 Jan 2023
This seems to work!
arrayfun(@(x,y) copyobj(flipud(x.Children),y),tree1,tree2)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!