필터 지우기
필터 지우기

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

조회 수: 5 (최근 30일)
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?

답변 (1개)

Adam
Adam 2016년 1월 13일
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
Gee Cheng Mun
Gee Cheng Mun 2016년 1월 14일
Is it okay if you can show me some examples using the code?
Adam
Adam 2016년 1월 14일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by