- Download the struct2Tree from file exchange.
- Extract the Zip to the same folder.
- Created a new mlapp in the extracted folder (struct2tree).
- Added a button to the 'Design View'
How to load a struct to an uitree in AppDesigner?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I have an uitree in my AppDesigner GUI.
Is there a fast & convenient way to load a struct into my Tree.
My struct can vary in it's layers ("depth"). It can be:
S.L1.L2 or S.L1.L2.L3. etc...
I've found the following function on FileExchange:
struct2tree (https://www.mathworks.com/matlabcentral/fileexchange/42487-struct2tree).
But after I ran the code:
[m_tree , m_container] = struct2tree(my_struct);
I don't know how to "convert" (or maybe "display" is the more appropriate term) the data stored in m_tree and/or m_container to my uitree in the GUI itself.
I really hope struct2tree could help me. Since I don't know in advance the "depth" of my struct, I don't want start writing any recursive functions "extracting" all the layers from my struct and "building" uitree.
Thanks!!!
0 comentarios
Respuestas (1)
prabhat kumar sharma
el 17 de En. de 2024
Hi Mark,
I have downloaded the struct2tree from the file exchange link you provided and tried creating the UITree.
Here are the steps I followed.
function ButtonPushed(app, event)
S = struct('Field1', 'Value1', 'Field2', struct('SubField1', 'SubValue1'));
h = gcf;
struct2tree(S);
end
5. Added a callback function to the button.
6. The UITree created and looks like below screenshot.
I hope it helps!
0 comentarios
Ver también
Categorías
Más información sobre Data Type Conversion en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!