How to navigate through Struct/Cell from Matlab Gui?

조회 수: 4 (최근 30일)
Ravi Goyal
Ravi Goyal 2014년 8월 19일
답변: Ravi Goyal 2014년 8월 20일
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

답변 (2개)

Evan
Evan 2014년 8월 19일
편집: Evan 2014년 8월 19일
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
Ravi Goyal
Ravi Goyal 2014년 8월 19일
Well yes kind of. I want to be able to select certain data from a struct/cell. Through performing large measurements, data sets are created and all nicely sorted in a cell. To load specific data from one measurment into a gui, I would like to select which cell content to use.
This is possible from the Workspace of matlab to navigate through the cells/struct, but I dont know how to implement or use such navigation from within a GUI...
Evan
Evan 2014년 8월 19일
편집: Evan 2014년 8월 19일
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.

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


Ravi Goyal
Ravi Goyal 2014년 8월 20일
The Cells contain lots of data normally and can be structured differently. So, I feel a uitable could not display everything properly. My GUI is made with GUIDE and I am using handles structure.
I want to get variables from the workspace of Matlab though, and with arrays its no problem. The easiest would be if the Variables Field which opens if you double click a variable from the workspace could be used somehow or implemented as GUI or assigned the handles of my gui.
Who works nicely, yet only gives me the Variable name of the whole cell. Sth like uitree or similar also looks promising yet there is nothing official so a user could select data from within a cell/struct? Any further suggestion maybe? Thanks a bunch

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by