Modify Knob From App Designer
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sossio Del Prete
le 3 Sep 2020
Commenté : Geoff Hayes
le 8 Sep 2020
How can I modify the Knob from code-wiew in the App Designer through a callback, for example I would like to set the fixed values of the knob only multiples of 2 (example: 2 ^ 1, 2 ^ 2, 2 ^ 3, 2 ^ 4) and the space between them without changing their numerical value.
0 commentaires
Réponse acceptée
Geoff Hayes
le 3 Sep 2020
Sossio - I suspect that you will want to create a discrete uiknob. Perhaps something like the following will do
fig = uifigure;
kb = uiknob(fig, 'discrete');
kb.Items = split(num2str(2.^[1:4]));
kb.ItemsData = {2 4 8 16};
The above simplifies (somewhat) what you want to do as you would want to access the kb via the App object (I'm guessing) in whatever callback you wish to make this change.
3 commentaires
Geoff Hayes
le 8 Sep 2020
Sossio's answer moved here
I have to do the same thing with the slider, is it possible with the same code?
Geoff Hayes
le 8 Sep 2020
Perhaps https://www.mathworks.com/matlabcentral/answers/446323-how-to-enable-snap-to-tick-for-a-slider-in-app-designer will provide an idea of what you can do.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!