Filter löschen
Filter löschen

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

5 Ansichten (letzte 30 Tage)
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?

Antworten (1)

Adam
Adam am 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 Kommentare
Gee Cheng Mun
Gee Cheng Mun am 14 Jan. 2016
Is it okay if you can show me some examples using the code?
Adam
Adam am 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by