GUI check state of radio button in another callback

7 ビュー (過去 30 日間)
Nicholas Wills
Nicholas Wills 2017 年 11 月 21 日
コメント済み: Adaikan Kannappan 2021 年 6 月 18 日
I have a push button callback, and a selection of radio buttons. Within the push button I want to be able to say
if radio1 selected
% code
else if radio 2 selected
% do
end
This would naturally have to update whenever the radio button selection was changed.
How would I do this?
  1 件のコメント
Mubarak Mubarak MohamedSaeed
Mubarak Mubarak MohamedSaeed 2020 年 4 月 30 日
編集済み: Mubarak Mubarak MohamedSaeed 2020 年 5 月 1 日
Hi, I want to ask about how to use the Radio Button Group at App Designer....... I have tried but it did not work...

サインインしてコメントする。

採用された回答

Jan
Jan 2017 年 11 月 21 日
編集済み: Jan 2017 年 11 月 21 日
if handles.radio1.Value == 1
% code
elseif handles.radio2.Value == 1
% other code
end
Here I guess, that you work with GUIDE and that the radio buttons got the tags "radio1" and "radio2". You have to adjust this to your real names. If you do not know than, search in GUIDE or set a breakpoint in the callback. Then run the code and display the contents of the handles struct, when Matlab stops.
This would naturally have to update whenever the radio button
selection was changed.
What should be updated? The Value property is equivalent to the current setting automatically. Or do you mean, that the shown callback should be triggered, when the radio buttons are selected?
  2 件のコメント
Nicholas Wills
Nicholas Wills 2017 年 11 月 22 日
That works perfectly, thank you!
Adaikan Kannappan
Adaikan Kannappan 2021 年 6 月 18 日
Thank you so much!~

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by