Change number of drop downs based on spinner value using matlab app designer?
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
James Nestler
il 19 Ott 2021
Commentato: Cris LaPierre
il 20 Ott 2021
I want to plot a variable number of lines. The number of lines will be set by the spinner value. I want three drop downs to appear for each line so that I can specify linewidth, color, and linestyle. So if spinner value = 1, 3 drop downs will appear in one row. If spinner value = 2, 6 drop downs will appear in 2 rows (3 columns), etc. Is it dynamically possible to change the number of drop downs to appear in my GUI? If so, any recommendations to make this happen?
Thanks
0 Commenti
Risposta accettata
Image Analyst
il 19 Ott 2021
I suggest you place all the drop downs on the figure in App Designer, and then set the visibility of all but the first to off/0/hidden so they aren't shown. Then as you spin the widget, set the visibility of the appropriate drops downs to on/1/shown so that they appear. I think this is much easier than trying to create and place them on the fly.
1 Commento
Più risposte (1)
Cris LaPierre
il 19 Ott 2021
Modificato: Cris LaPierre
il 19 Ott 2021
The hard part is going to be dynamically coming up with the position of the drop boxes.
2 Commenti
Cris LaPierre
il 20 Ott 2021
I don't believe you can dynamically create app properties (but have not confirmed that). At the least, this page shows you the way you are intended to create app properties.
https://www.mathworks.com/help/matlab/creating_guis/share-data-across-callbacks-in-app-designer.html
If you follow Image Analysts' suggestion, then you will not have to dynamically create component object handles.
Vedere anche
Categorie
Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!