フィルターのクリア

Appdesigner get Index and String from DropDownMenu

31 ビュー (過去 30 日間)
Jan w
Jan w 2019 年 10 月 23 日
回答済み: Voss 2023 年 2 月 23 日
Hello everyone,
Is there a way I can get the index and the string in a dropdown menu selection?
I had the idea to set up this pice of code in the openinfunction to change the DropDown.Value to the index
app.DropDown.ItemsData=1:numel(app.DropDown.Items);
Later I would get the index with
val = DropDown.Value;
and the string with
Str = DropDown.Items{val};
Do you know of a better way since my method seems to be too complicated. Thanks for any help!
Regards J.

回答 (1 件)

Voss
Voss 2023 年 2 月 23 日
If you need the index and the string, then the way you're doing it is good.
If you just need the string, you should do away with ItemsData and just do
Str = DropDown.Value;

カテゴリ

Help Center および File ExchangeSimulink Environment Customization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by