Effacer les filtres
Effacer les filtres

How to display a different SELECT menu depending on the radiobutton using MATLAB gui?

5 vues (au cours des 30 derniers jours)
Gee Cheng Mun
Gee Cheng Mun le 13 Jan 2016
Commenté : Adam le 14 Jan 2016
I would to create two different radio button which is able to direct to their respective SELECT menu. How can I do this in MATLAB?

Réponses (1)

Adam
Adam le 13 Jan 2016
Using GUIDE is the simplest method as it will setup the (empty) callbacks for you and allow you to position the radio buttons as you want (make sure you put them inside a Button Group though.
The documentation gives examples of creating a uibuttongroup programmatically using the SelectionChangedFcn as the callback to control all radio buttons within the group.
doc uibuttongroup
The SelectionChangedFcn can also be set for a GUIDE GUI by right-clicking in your button group in GUIDE and selecting 'View Callbacks'. Selecting it from this list will create the empty callback function for you to fill in as you would in the programmatic example.
Within that callback you can distinguish the clicked radio button either by string or tag. I favour tag, but it helps to make sure you set a useful tag name on each radio button when you do this rather than just radiobutton1, radiobutton2, etc.
  2 commentaires
Gee Cheng Mun
Gee Cheng Mun le 14 Jan 2016
Is it okay if you can show me some examples using the code?
Adam
Adam le 14 Jan 2016
The example on the help page for uibuttongroup shows how to set up radio buttons with a callback programmatically. In GUIDE it is simpler, but can't be shown here without attaching an actual .fig and .m file which I don't have time to do.
What you do in the SelectionChangedCallback depends entirely on how you want to respond to the two radio buttons. I don't know what you are wanting to do as a "select" menu doesn't really mean anything to me.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by