|
Helena;
Forgive me if I'm wrong; but I think you've missed a
fundamental point of radiobuttons. Try this, and see if it
helps your understanding of your use:
Create a button group in a GUI. It's a type of uipanel, but
should only be used for radiobuttons. Drop two radiobuttons
in there.
Leave it as it is for the mo, but you can change the
start-up values of radiobuttons if you want: right-click >
property editor > value > change from 0.0 to 1.0.
Start the GUI, then select the unselected button. They
change over automatically, with no need for switch-case or
callbacks.
Now check the m-file. No callbacks have been created.
If you want code to execute upon change of radiobutton, then
use the uibuttongroup's SelectionChangeFcn (right-click on
the panel in guide > view callbacks > SelectionChangeFcn).
If you want code to determine which of the buttons has been
pressed, use:
h = get(handles.uibuttongroup,'SelectedObject')
This returns the handle to the selected object. Then use:
s = get(h,'String')
To retrieve the string label of the individual button.
If a callback is automatically created by the GUI (e.g. if
you only want one radiobutton, so don't use a group), then
you can't just delete it without deleting the button in
GUIDE first. If it's unwanted; then what I do is just cut
and paste it right to the bottom of the m-file; then forget
about it forever :)
I hope that helps, Kind Regards
Tom Clark
|