setting radiobutton value by program

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 日

3 投票

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 日

0 投票

Also works with:
app.ButtonGroup.SelectedObject = app.ButtonA;

カテゴリ

ヘルプ センター および File ExchangeInteractive Control and Callbacks についてさらに検索

質問済み:

2015 年 1 月 28 日

移動済み:

2024 年 5 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by