Items + Items Data issue

11 ビュー (過去 30 日間)
Anna Case
Anna Case 2020 年 5 月 13 日
コメント済み: Ameer Hamza 2020 年 5 月 14 日
I have defined:
app.select_solver_calc_properties.Items = {'Fminsearch', 'Fmincon', 'Look-up Table', 'Genetic Algorithm'};
app.select_solver_calc_properties.ItemsData = {'[1 2 3 4]'};
When I run
app.select_solver_calc_properties.Value = 3;
I get the error:
'Value' must be an element defined in the 'ItemsData' property.
I've consulted the dropdown page with no success. What am I doing wrong?
EDIT: The issue is that the inspector defaults to a non-numeric type for ItemsData. I'm not sure how to fix this since I can't edit the component setup part in App Designer.

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 5 月 13 日
You are using char array to set the UserData property. You should just pass it a numeric array
app.select_solver_calc_properties.ItemsData = [1 2 3 4];
  4 件のコメント
Anna Case
Anna Case 2020 年 5 月 14 日
For a large application this is going to make the startup quite bulky, but I suppose it's the best solution. Hopefully this gets fixed in a future release. Thanks.
Ameer Hamza
Ameer Hamza 2020 年 5 月 14 日
I am glad to be of help.
Hopefully, they will make it possible to specify a numeric array directly from the inspector panel.

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

その他の回答 (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