How to navigate through Struct/Cell from Matlab Gui?
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (2개)
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
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!