Borrar filtros
Borrar filtros

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

5 visualizaciones (últimos 30 días)
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?

Respuestas (1)

Adam
Adam el 13 de En. de 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 comentarios
Gee Cheng Mun
Gee Cheng Mun el 14 de En. de 2016
Is it okay if you can show me some examples using the code?
Adam
Adam el 14 de En. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by