How do I change the options in a dropdown menu after a button is pressed in app designer?
24 ビュー (過去 30 日間)
古いコメントを表示
To keep this short:
I have a dropdown menu with 7 options, and a button. In the buttons callback function I want to be able to remove some of the options to reduce the number of options to say 5.
How can I do this?
0 件のコメント
採用された回答
Jinal
2023 年 3 月 16 日
Hi Carson,
As per my understanding you wish to use the button you have created to reduce the number of available options in your dropdown menu.
You can do this using the following as the body of your button’s callback function.
app.DropDown.Items = {'Option 1', 'Option 2', 'Option 3','Option 4', 'Option 5'};
If you are using a state button, the callback function’s body would would look like following:
value = app.Button1.Value;
if value == 1
app.DropDown.Items = {'Option 1', 'Option 2', 'Option 3','Option 4', 'Option 5'};
else
app.DropDown.Items = {''Option 1', 'Option 2', 'Option 3','Option 4', 'Option 5', Option 6', 'Option 7'};
end
Hope this helps.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!