"PinkLab " <hussains_k@hotmail.com> wrote in message <hbpqj1$i7o$1@fred.mathworks.com>...
> I am trying to create a callback on push button,
>
> If radio1 is selected then run case 1
> If radio2 is selected then run case 2
> If radio3 is selected then run case 3
>
> Any hint how to write this code??
"PinkLab " <hussains_k@hotmail.com> wrote in message <hbpqj1$i7o$1@fred.mathworks.com>...
> I am trying to create a callback on push button,
>
> If radio1 is selected then run case 1
> If radio2 is selected then run case 2
> If radio3 is selected then run case 3
>
> Any hint how to write this code??
Straight off of the top of my head (meaning there is probably a lot slicker ways of doing it)
1) Define yourself a handles variable say handles.Case_Select
2) In your radio1 button callback insert something like
handles.CaseSelect = 1;
% Update handles structure
guidata(hObject, handles);
3) In your radio2 button callback
handles.CaseSelect = 2;
% Update handles structure
guidata(hObject, handles);
etc.
Now your switch statement looks like
switch handles.CaseSelect
case(1)
--- do case1 things---
case(2)
---do case2 things
end
Its rather crude, but should do what you want. If I think of a better idea, I will come back.
If I understood right you want to implement a callback of a pushbutton.
That can mean the action occurs not by selecting a radio button?
In this case a variable like "handles.myCaseId" is a good solution.
If action shall occure by clicking a radio button AND they are exclusive, meaning activating one radio will deactivate the other(s), then a buttonGroupBox is the solution. In this case you can implement the selectionChanged-function of the buttonGroupBox.
Yes, you are right, i need callback in Button1 so when radio1 is selected do that task otherwise depending on which radio is selected do that particular task.... the task is to create a plot on axes so please help.........
"Lars" <mustermann.klaus.TO.REMOVE@gmx.de> wrote in message <hbq4cb$ecq$1@fred.mathworks.com>...
> If I understood right you want to implement a callback of a pushbutton.
> That can mean the action occurs not by selecting a radio button?
>
> In this case a variable like "handles.myCaseId" is a good solution.
>
> If action shall occure by clicking a radio button AND they are exclusive, meaning activating one radio will deactivate the other(s), then a buttonGroupBox is the solution. In this case you can implement the selectionChanged-function of the buttonGroupBox.
Matt, it didn't work... i am not sure why it is not plotting the graph on my axes in GUI after i press the generate button...
"Matt Fig" <spamanon@yahoo.com> wrote in message <hbq01l$of$1@fred.mathworks.com>...
> Have all three call the same callback:
>
> function []=radio_callback(hObject,EventData,handles)
>
> switch hObject
> case handles.radio1
> % run case 1
> case handles.radio2
> % run case 2
> case handles.radio3
> % run case 3
> otherwise
> % Whatever
> end
Tags for this Thread
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.
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.