필터 지우기
필터 지우기

Copy nodes and sub-nodes of uitree to another uitree

조회 수: 11 (최근 30일)
Hossein Sadeghi
Hossein Sadeghi 2022년 2월 15일
답변: James Sweetman 2023년 1월 2일
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.
  댓글 수: 2
Simon Chan
Simon Chan 2022년 2월 15일
Did you try the following?
copyobj(nodes(1),tree2)
copyobj(nodes(2),tree2)
Hossein Sadeghi
Hossein Sadeghi 2022년 2월 15일
Yes, same error!

댓글을 달려면 로그인하십시오.

답변 (1개)

James Sweetman
James Sweetman 2023년 1월 2일
This seems to work!
arrayfun(@(x,y) copyobj(flipud(x.Children),y),tree1,tree2)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by