Can I create a drop down menu in App Designer in which the drop down items reference a cell array?

조회 수: 4 (최근 30일)
I have a 20x1 cell array with values that change depending on the array input, and I would like to link this to a drop down menu within App Designer. Is there a way to get the drop down menu to reference an external array for the values, or is a manual Item input the only way to go?

채택된 답변

Adam Danz
Adam Danz 2021년 3월 4일
편집: Adam Danz 2021년 3월 5일
The handle to the dropdown menu must be available in the same workspace that updates the cell array. If that's done in AppDesigner, the handle should be in the app class variable. If the cell array is updated outside of app designer, you'll need to pass the dropdown menu handle (or entire app handle) to that function.
Every time the cell is updated, update the Items propery of the uidropdown menu.
An alternative and less efficient method would be to define the cell array as an app property and use a timer object to iteratively check if the cell array has changed and to update the Items list.
  댓글 수: 2
Rob Blackburn
Rob Blackburn 2021년 3월 5일
Thank you Adam. What I ended up doing which seemed to be the quickest way to update everything was to have my Matlab script produce an excel sheet with my cell array values, and then have AppDesigner read that excel sheet and extract the values when called via a push button.
Thank you for your help
Adam Danz
Adam Danz 2021년 3월 5일
Why not set the dropdown menu directly from the source that produces the cell array? That would avoid writing/reading to file and the need to press the push button to update the menu.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by