How to change global variable value with radio button?
Mostrar comentarios más antiguos
I have 2 group button like this, and global variables where d_u and d_a must changed if Data test and performance goal clicked.

how to change global variable value if one of the button clicked?
help me please :)
2 comentarios
Geoff Hayes
el 25 de Feb. de 2019
Angaa - you will need a callback for your radio button group. But do you really need a global variable? Have you created your GUI with GUIDE, App Designer, or programmatically?
Respuestas (1)
Geoff Hayes
el 26 de Feb. de 2019
1 voto
Angga - instead of putting your radio buttons in a panel (which I think you may have done but I can't be sure) you would use a Button Group instead. So from the GUIDE editor, you would select the Button Group control/widget and drag it on to your GUI. You would then place the radio buttons within this group. See Button Group Callbacks for how to add a callback to this group so that the callback will fire whenever a radio button (from that group) is changed.
An alternative to global variables is to use the handles structure that is passed around to all callbacks in your GUI. See Store or retrieve UI data for details.
Categorías
Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!