Button Group / make radiobutton exclusive
显示 更早的评论
Hey guys, i have create a bunch of radiobuttons in one GUI. Now I want to make each radiobutton exclusive.... only one button can be active... if the use activates a new radiobutton the old one`s value is 0 (inactive). i have tried to use the SelectionChangeFcn but somehow it doesnt work. Can u guys give me an example with 2 radiobuttons in one panel ? i am going on to search for a solution.
Oh and pls use GUIDE in ur explaination.
3 个评论
Did you use the button group panel and drag your radio buttons onto the panel? That should ensure mutual exclusivity and then your SelectionChangeFcn is just for reacting to which one is actually selected. I don't have time to fish out an example right now, but if no-one else has replied later on I will.
Max Müller
2014-9-24
Actually I just took a look at creating a new radio button group. It looks like it has changed in recent versions of Matlab so you don't have to do so much manually.
Now when you drop radio buttons into a group your callback will be set to @manageButtons as shown below. You should be able to leave that as is and just add a SelectionChangeFcn. In previous versions I seem to remember having to get rid of callbacks manually when I added a SelectionChangeFcn
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

