appdesigner - how do I set the default entries in a drop-down list upon app startup?

23 ビュー (過去 30 日間)
Iddo Weiner
Iddo Weiner 2019 年 2 月 27 日
編集済み: Iddo Weiner 2019 年 2 月 27 日
I have a dropdown list in my GUI, and I want it to have ~1,000 different entries which the user can select from.
Of course I can enter them manually, but this is obviously a bad solution.
What I want to do is plant a piece of code into the automatically generated appdesign code, right after the dropdown menu is created, in which I tell it to display entires read from a cell array I give it.
This must be possible, but after reading stuff like - https://www.mathworks.com/help/matlab/ref/matlab.ui.control.uicontrol-properties.html - I'm still not quite sure how to do this.
Any suggestions?
Thanks
Iddo

採用された回答

Iddo Weiner
Iddo Weiner 2019 年 2 月 27 日
編集済み: Iddo Weiner 2019 年 2 月 27 日
Oh, I just figured it out. Here's how:
You add a startupFCNcallback (right click on the main app component)
In the callback body you write:
load('cell_with_my_names.mat')
app.DropDown.Items = cell_with_my_names

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by