How to set ItemsData using external file (App Designer)?
조회 수: 2 (최근 30일)
이전 댓글 표시
The purpose of my app is to create a UI which allows the user to select data they want to graph through a drop-down menu and adjust the graph to their liking through a series of edit fields. However, I am currently having trouble setting the ItemsData of my drop-down menu to the array variable from an external .mat file. Some of the difficulty stems from this being a multiwindowed app (based heavily on this tutorial). I am currently able to load the .mat file, but I can't figure out how to pass the array data to the popup window class and set it as an ItemData for the drop-down window. Attached are .txt files for both the main window and the popup window.
I greatly appreciate any suggestions on how to solve this.
댓글 수: 5
Kevin Chng
2018년 10월 20일
Hi gage benham, refer to my answer for it.
I recommend you modify your title so that it is not so confusing if people search for relevant solution.
답변 (1개)
Kevin Chng
2018년 10월 20일
Hi gage benham,
1st Step :
load your mat file. Make all the variable display in your drop menu automatically.
filename = whos(matfile('aaa.mat')); w=load('aaa.mat') for i =1:1:numel(filename) A(i) = cellstr(filename(i).name); app.var(i) = w.(A{i}) end app.DropDown.Items = cellstr(A);
in first step, you are assignig all value of variable into app.var. You might need to expand the dimension of app.var(i) if needed
2nd Step :
In your call back function for plot
for i=1:1:numel(filename) if strcmp(app.DropDown.Value,filename(i).name) plot(var(i)) end end
Therefore, i gues now your apps is more dynamically even you have more variable in your mat.file.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!