How to navigate through Struct/Cell from Matlab Gui?
5 views (last 30 days)
Show older comments
Dear Community,
I have a GUI which can load data from the workspace. Like the Curve Fitting App from Matlab I can read arrays with a pop up menu and use the data. Yet, if my data is a struct or cell, I would like to navigate through that and select my choice of data.
I was thinking of a pop up menu which detects if it is a struct/cell and than has a arrow to the right to go one step deeper. Comparable to a normal windows start button menu, where the content can be reached by continuing the path given when there is an arrow.
Has anyone any idea how to realize such thing in Matlab, or a different way to navigate to the data if in struct/cell from a Gui?
Thanks Ravi
0 Comments
Answers (2)
Evan
on 19 Aug 2014
Edited: Evan
on 19 Aug 2014
For determining the datatype of the arrays selected by the user, see the iscell and isstruct functions. The who command can allow you to obtain the names of the variables in your workspace. Or, if you're using the handles structure, fieldnames can do the equivalent.
4 Comments
Evan
on 19 Aug 2014
Edited: Evan
on 19 Aug 2014
If you are wanting to display individual cells/fields, I would suggest allowing the user to specify a field/row & column based on their cell/struct selection, and that could then be displayed in an edit box. If you want to look at the entire selected cell/struct, I would suggest displaying it in a uitable on your GUI.
Are the data you're using (whether they be cells, structs, etc.) stored in the handles structure when loaded/created? I would suggest this, especially if you're using GUIDE to create your GUI.
See Also
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!