How to reset Drop Down control value (NOT uidropdown) - with example
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Paul
il 20 Dic 2022
Modificato: Samayochita
il 14 Ago 2025 alle 6:34
I have the following code (showing picture because I can't display the drop down here)

I can't find a way to make sure that each time the code is run, the drop down is set to the first item in the list. The second line was my attempt but it doesn't work. Is there a way to do this (in the Configure Control dialog the default is set to "Acetamide". Sample code is attached.
0 Commenti
Risposta accettata
Samayochita
il 20 Giu 2025
Modificato: Samayochita
il 14 Ago 2025 alle 6:34
Hi Paul,
I understand that while using a Live Editor Drop Down Control when we change the selected value in the dropdown during execution, and then re-run the script, the dropdown remembers the last selected item instead of resetting to the default value.
Live Editor controls in MATLAB preserve state between runs, they do not reset automatically even if we have specified a default value in the Configure Control.
If we are looking for the UI itself to reset visually, that is not possible with Live Script controls alone, we would need to use App Designer or uidropdown in a uifigure.
A MATLAB Central Answer that highlights this point:
https://www.mathworks.com/matlabcentral/answers/1672669-how-to-add-control-to-restore-all-default-values-in-a-live-script
Hope this helps!
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Specifying Target for Graphics Output 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!