GUI: how to configure radio buttons to activate/grey out a set of checkboxes?
13 次查看(过去 30 天)
显示 更早的评论
Hello, I'm discovering the MATLAB GUI possibilities. Aim: to provide a user with a GUI to select some parameters that are necessary for running a program code. Specific: how do I configure the action applied to a set of 2 mutually exclusive radio buttons so that they activate or grey out a set of checkboxes. So, for instance, when the user selects the 'On' radio button, a set of checkboxes must be enabled. Can someone help me with this?
Thanks in advance!
采纳的回答
Paulo Silva
2011-8-30
Using GUIDE
- Put one Button Group on your GUI
- Put two radiobutton inside the Button Group (that makes them mutually exclusive)
- Put the checkboxes on your GUIDE
- Click on the first radiobutton with your mouse right button, View Callbacks -> Callback
- MATLAB takes you to the m file of the GUI, now you can put the code that runs when you choose that radiobutton
By grey out you mean that the checkboxes are disabled (you can't check them), do this
set(handles.checkbox1,'Enable','off') %disable checkbox1
Do the same for every checkbox you want to disable.
Now to re enable them do the same steps for the other radiobutton but the code is:
set(handles.checkbox1,'Enable','on') %enable checkbox1
3 个评论
Paulo Silva
2011-8-31
hmmm I can adjust individual callbacks just fine (MATLAB 2008b), make sure that you are not clicking on the button group instead of the radiobutton when clicking.
更多回答(2 个)
geomod
2011-9-1
2 个评论
Paulo Silva
2011-9-1
What you want to do is to show the image not change some axes property
axes(handles.axes2) %select axes2, it becomes the current axes
if get(hObject,'Value') == 1
image(imageA) %or whatever code you have to show the image
else
image(imageB)
end
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!