GUI check state of radio button in another callback
8 次查看(过去 30 天)
显示 更早的评论
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
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
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?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!