setting radiobutton value by program

조회 수: 13 (최근 30일)
Diego
Diego 2015년 1월 28일
이동: Image Analyst 2024년 5월 22일
I have a panel with several radiobuttons so that only one of them is selected at the time, it works fine with my mouse. However, I want to create a pushbutton that when I push it will select a specific radiobutton on the panel
So for example I have radiobuttons A B and C and I clicked on C at one time then with the pushbutton I want to set A again as if I have clicked A with my mouse.. how can I do that??
Thank you in advance...

채택된 답변

Image Analyst
Image Analyst 2015년 1월 28일
Yes. Do it this way:
set(handles.radioA, 'Value', 1);
If the other B & C radio buttons are in a group panel, then the B & C radio buttons will automatically be set to false once this line executes . Otherwise you can set them to false manually with the set() function also.
  댓글 수: 1
Image Analyst
Image Analyst 2015년 1월 28일
편집: Image Analyst 2015년 1월 28일
Diego's "Answer" moved here since it's not an answer to the original question:
thank you very much

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

추가 답변 (1개)

Josiah Brough
Josiah Brough 2024년 5월 20일
이동: Image Analyst 2024년 5월 22일
Also works with:
app.ButtonGroup.SelectedObject = app.ButtonA;

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by