Thread Subject: GUI--radioButton

Subject: GUI--radioButton

From: helena raz

Date: 21 Aug, 2007 16:59:40

Message: 1 of 4

I created a radio button in GUIDE and then right clicked
and chose "View Callback" and then selected callback. this
led to creation of a callback for that radiobutton in my
mfile. then i deleted the radiobutton call back from
mfile and ran it. i got an error:

??? Error using ==> feval
Undefined function or method 'InjectTimeOne_Callback' for
input arguments of type 'struct'.

Error in ==> gui_mainfcn at 95
        feval(varargin{:});

Error in ==> finalGUI at 42
    gui_mainfcn(gui_State, varargin{:});

??? Error using ==> finalGUI('InjectTimeOne_Callback',gcbo,
[],guidata(gcbo))
Error using ==> feval
Undefined function or method 'InjectTimeOne_Callback' for
input arguments of type 'struct'.

??? Error while evaluating uicontrol Callback






Is there anyway to get rid of radiobutton callback in
mfile without getting an error??

If i want to use "switch case..." for a couple of
radiobuttons, then I won't need radiobutton callbacks,
correct?

thanks a lot!

Subject: GUI--radioButton

From: Thomas Clark

Date: 22 Aug, 2007 16:03:40

Message: 2 of 4

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

Subject: GUI--radioButton

From: helena raz

Date: 22 Aug, 2007 16:24:12

Message: 3 of 4

Hi Tom,
Thanks a lot for your reply.
I understand that whenever one creates a uibuttongroup
panel with a couple of radio buttons, there are no
function callbacks for the individual radio buttons. Like
you said there is SelectionChangeFcn.

In my case, however, I right clicked on one of
radiobuttons in guide and then selected callback. this
generated a callback for that specific radiobutton that I
right-clicked on. so when i tried to delete that from
the mfile (b.c the rest of the radiobuttons did not have a
callback in the mfile), I got an error.

I guess I should I have deleted that radio button as well.

Thanks for your help.

Subject: GUI--radioButton

From: PinkLab

Date: 29 Oct, 2009 18:48:02

Message: 4 of 4

I have tried

Check = get(handles.uibuttongroup,'SelectedObject')
if Check == radiobutton1
% than perform this task

elseif Check == radiobutton2
% than perform this task

==================

It returns the error

???Reference to non-existent field 'uibuttongroup'


Any help please? or any alternate way to perform which radio button is selected, I need this for my push button callback, please help! thanks

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
radiobutton Thomas Clark 22 Aug, 2007 12:05:10
uibuttongroup Thomas Clark 22 Aug, 2007 12:05:10
gui Ned Gulley 21 Aug, 2007 23:47:45
guide Ned Gulley 21 Aug, 2007 23:47:45
guiradiobutton helena raz 21 Aug, 2007 13:00:24
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com