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일

0 개 추천

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일
Sorry, as stated in the edit I am setting these values in the "inspector" on the right hand of the screen. It will not let me edit the constructor area of the code. I've tried passing 1 2 3 4 and many other variants. How can I fix this?
Ameer Hamza
Ameer Hamza 2020년 5월 14일
Ok, I tried it a bit, and It seems that the inspector window does not allow numeric values. It only allows character inputs. However, the way you are writing in the inspector window is not correct. You should just write one data item at each line. See the attached app for the correct syntax. Also, to use numeric values, you need to change the ItemsData property in startupFcn. See the attached file for a very simple demo.
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개)

카테고리

도움말 센터File Exchange에서 App Building에 대해 자세히 알아보기

제품

질문:

2020년 5월 13일

댓글:

2020년 5월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by