MATLAB Answers

How to Set App Designer Drop Down and List Box Data types

315 views (last 30 days)
M G
M G on 16 May 2018
Answered: Chris Portal on 20 May 2018
I've started a new question, as I am experiencing the same difficulty with Drop Down menus in App Designer. A previous answer suggested that I consult https://www.mathworks.com/help/matlab/ref/uilistbox.html#bui0qid, and so I did that. The referenced URL displays some code that is generated _ programmatically_ for UIFigures, even though the title of the URL page suggests that the process is the same for App Designer.
However, when I try to insert or edit any extra lines of code into script that is generated by App Designer [in the UIFigure "function createComponents(app)"], that is simply not allowed.
It does seem to me that the _ * only*_ way to make changes to any of the List Box Properties in App Designer is via the LIST BOX PROPERTIES dialog panel.
I have hacked at this for awhile now and I have included an attachment with markups and some comments. It is easy to see that in the first panel, the ItemsData is in the format * [0,25,40,100]* and this is recognized by the code as numerical.
If one enters the numerical Data you wish to associate with the Items simply as numbers within the App Designer dialog box, they appear in the code as ={'1', '2', '3', '4'}, and are treated as CHARACTERS.
If one instead enters the numerical Data you wish to associate with the Items as a string of numbers enclosed within square brackets =[ ...] via the App Designer LIST BOX PROPERTIES dialog box, both the square brackets _ and_ the data that they contain are all treated as CHARACTERS.
Given that you cannot edit the Code generated by App Designer, and are confined to using the LIST BOX PROPERTIES dialog box, only, _ How do you force App Designer to treat the values entered there as double-precision Numerical (Scalar) quantities?_

  0 Comments

Sign in to comment.