How do I insert a tree object generated by external function into App Designer?

조회 수: 1(최근 30일)
I am new to GUI and am really struggling to figure out these parent and container things. I generated a uitree object using an external function struct2tree
function [tree,container] = struct2tree(S,h)
%STRUCT2TREE renders the given structure as a uitree object
% [TREE,CONTAINER] = STRUCT2TREE(S) returns the uitree object and its
% container object rendered in the current figure.
%
% ... STRUCT2TREE(S,H) renders the uitree in the given container.
%Example
%
% [tree,container] = struct2tree(S,gcf);
% set(tree,'NodeSelectedCallback',@myNodeSelectedCallback)
% set(container,'units','normalized','position',[0 0 1 1])
if nargin==1,h=gcf;end
if isscalar(S)
root = struct2node(S);
else
root = uitreenode('v0','Root','Root',[],false);
name = inputname(1);
arrayfun(@(x)root.add(struct2node(x,name)),S);
end
% [tree,container] = uitree('v0','Root',root);
[tree,container] = uitree('v0','Root',root);
set(container,'Parent',h)
And I want to display this tree in my app in App Designer, which already has an app.Tree object. No matter what inputs I use, it either generates the tree in another figure window (see below) or produces an error, wrong parent object or something.
What inputs and outputs should I use to make it appear in my app?
  댓글 수: 1
Walter Roberson
Walter Roberson 2022년 6월 3일
What is the error when you pass the existing uitree as the second parameter to struct2tree()?

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

답변(0개)

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by