<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263865</link>
    <title>MATLAB Central Newsreader - Button Callback - Matlab Issue</title>
    <description>Feed for thread: Button Callback - Matlab Issue</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 22 Oct 2009 14:35:13 -0400</pubDate>
      <title>Button Callback - Matlab Issue</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263865#689026</link>
      <author>PinkLab </author>
      <description>I am trying to create a callback on push button, &lt;br&gt;
&lt;br&gt;
If radio1 is selected then run case 1 &lt;br&gt;
If radio2 is selected then run case 2&lt;br&gt;
If radio3 is selected then run case 3&lt;br&gt;
&lt;br&gt;
Any hint how to write this code??</description>
    </item>
    <item>
      <pubDate>Thu, 22 Oct 2009 14:53:03 -0400</pubDate>
      <title>Re: Button Callback - Matlab Issue</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263865#689035</link>
      <author>Lars </author>
      <description>&quot;PinkLab &quot; &amp;lt;hussains_k@hotmail.com&amp;gt; wrote in message &amp;lt;hbpqj1$i7o$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I am trying to create a callback on push button, &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If radio1 is selected then run case 1 &lt;br&gt;
&amp;gt; If radio2 is selected then run case 2&lt;br&gt;
&amp;gt; If radio3 is selected then run case 3&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any hint how to write this code??&lt;br&gt;
&lt;br&gt;
get( radio1, value)&lt;br&gt;
&lt;br&gt;
see also button group</description>
    </item>
    <item>
      <pubDate>Thu, 22 Oct 2009 15:22:22 -0400</pubDate>
      <title>Re: Button Callback - Matlab Issue</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263865#689044</link>
      <author>Dave Robinson</author>
      <description>&quot;PinkLab &quot; &amp;lt;hussains_k@hotmail.com&amp;gt; wrote in message &amp;lt;hbpqj1$i7o$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I am trying to create a callback on push button, &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If radio1 is selected then run case 1 &lt;br&gt;
&amp;gt; If radio2 is selected then run case 2&lt;br&gt;
&amp;gt; If radio3 is selected then run case 3&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any hint how to write this code??&lt;br&gt;
&lt;br&gt;
Straight off of the top of my head (meaning there is probably a lot slicker ways of doing it)&lt;br&gt;
&lt;br&gt;
1) Define yourself a handles variable say handles.Case_Select&lt;br&gt;
&lt;br&gt;
2) In your radio1 button callback insert something like&lt;br&gt;
handles.CaseSelect = 1;&lt;br&gt;
% Update handles structure&lt;br&gt;
guidata(hObject, handles);&lt;br&gt;
&lt;br&gt;
3) In your radio2 button callback &lt;br&gt;
handles.CaseSelect = 2;&lt;br&gt;
% Update handles structure&lt;br&gt;
guidata(hObject, handles);&lt;br&gt;
&lt;br&gt;
etc.&lt;br&gt;
&lt;br&gt;
Now your switch statement looks like&lt;br&gt;
switch handles.CaseSelect&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;case(1)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;--- do case1 things---&lt;br&gt;
&amp;nbsp;&amp;nbsp;case(2)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;---do case2 things&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
Its rather crude, but should do what you want. If I think of a better idea, I will come back.&lt;br&gt;
&lt;br&gt;
Regards&lt;br&gt;
&lt;br&gt;
Dave Robinson</description>
    </item>
    <item>
      <pubDate>Thu, 22 Oct 2009 16:08:21 -0400</pubDate>
      <title>Re: Button Callback - Matlab Issue</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263865#689060</link>
      <author>Matt Fig</author>
      <description>Have all three call the same callback:&lt;br&gt;
&lt;br&gt;
function []=radio_callback(hObject,EventData,handles)&lt;br&gt;
&lt;br&gt;
switch hObject&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case handles.radio1&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;% run case 1&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case handles.radio2&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;% run case 2&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case handles.radio3&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;% run case 3&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;otherwise&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;% Whatever&lt;br&gt;
end</description>
    </item>
    <item>
      <pubDate>Thu, 22 Oct 2009 17:22:19 -0400</pubDate>
      <title>Re: Button Callback - Matlab Issue</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263865#689079</link>
      <author>Lars </author>
      <description>If I understood right you want to implement a callback of a pushbutton.&lt;br&gt;
That can mean the action occurs not by selecting a radio button?&lt;br&gt;
&lt;br&gt;
In this case a variable like &quot;handles.myCaseId&quot; is a good solution.&lt;br&gt;
&lt;br&gt;
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.</description>
    </item>
    <item>
      <pubDate>Fri, 23 Oct 2009 09:57:06 -0400</pubDate>
      <title>Re: Button Callback - Matlab Issue</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263865#689233</link>
      <author>PinkLab </author>
      <description>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.........&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Lars&quot; &amp;lt;mustermann.klaus.TO.REMOVE@gmx.de&amp;gt; wrote in message &amp;lt;hbq4cb$ecq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; If I understood right you want to implement a callback of a pushbutton.&lt;br&gt;
&amp;gt; That can mean the action occurs not by selecting a radio button?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In this case a variable like &quot;handles.myCaseId&quot; is a good solution.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 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.</description>
    </item>
    <item>
      <pubDate>Fri, 23 Oct 2009 14:29:19 -0400</pubDate>
      <title>Re: Button Callback - Matlab Issue</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263865#689293</link>
      <author>PinkLab </author>
      <description>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...&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Matt Fig&quot; &amp;lt;spamanon@yahoo.com&amp;gt; wrote in message &amp;lt;hbq01l$of$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Have all three call the same callback:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function []=radio_callback(hObject,EventData,handles)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; switch hObject&lt;br&gt;
&amp;gt;     case handles.radio1&lt;br&gt;
&amp;gt;         % run case 1&lt;br&gt;
&amp;gt;     case handles.radio2&lt;br&gt;
&amp;gt;         % run case 2&lt;br&gt;
&amp;gt;     case handles.radio3&lt;br&gt;
&amp;gt;         % run case 3&lt;br&gt;
&amp;gt;     otherwise&lt;br&gt;
&amp;gt;         % Whatever&lt;br&gt;
&amp;gt; end</description>
    </item>
  </channel>
</rss>

