Auto-populating a drop down menu in App Designer

9 ビュー (過去 30 日間)
Gabriel
Gabriel 2023 年 4 月 10 日
コメント済み: Gabriel 2023 年 4 月 10 日
I'm creating an app using the App Designer, and I would like to auto-populate a Drop-Down component by clicking a 'Run' button. This run button would loop over an array and assign each value of the array to one of the drop down options. Is this possible to code?

採用された回答

Cris LaPierre
Cris LaPierre 2023 年 4 月 10 日
You can find a list of the Drop Down properties you can access and modify here: https://www.mathworks.com/help/matlab/ref/matlab.ui.control.dropdown-properties.html
What is displayed in the dropdown is contained in the Items property. You don't have to loop though your array. You can assign them all at once. Just note that your array must be a cell array of character vectors, or a string array.
app.DropDown.Items = {'Red','Green','Blue'};
  1 件のコメント
Gabriel
Gabriel 2023 年 4 月 10 日
Thank you so much! This helped a lot.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by