<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265203</link>
    <title>MATLAB Central Newsreader - How to activate other callbacks only when a pushbutton is clicked?</title>
    <description>Feed for thread: How to activate other callbacks only when a pushbutton is clicked?</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>Fri, 06 Nov 2009 21:12:02 -0500</pubDate>
      <title>How to activate other callbacks only when a pushbutton is clicked?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265203#692789</link>
      <author>Rachel Laughs</author>
      <description>I am creating my first GUI in MATLAB. I prefer to do this programmatically.&lt;br&gt;
&lt;br&gt;
I have an initial figure/panel/menu thing set up with 3 interactive components:&lt;br&gt;
1. user is asked to enter in a filename, which will be loaded&lt;br&gt;
2. user is asked to select an item from a pop-up menu&lt;br&gt;
3. OK button to confirm choices and move on (aka intialize callbacks of parts 1 and 2)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
a) How do you associate the callbacks of the first two parts to the third, so that only when the &quot;OK&quot; button is pushed does the other callbacks occur?&lt;br&gt;
&lt;br&gt;
I tried to do this as 2 functions embedded in the push-button function, but I get the error &quot;undefined function or method...for input arguments&quot; which I am assuming is because this type of subfunction isn't allowed.  &lt;br&gt;
&lt;br&gt;
b) How do I take the entered string value from the edit uicontrol box (component 1) and have the callback function load this as a file?&lt;br&gt;
&lt;br&gt;
When I start messing with callbacks, I have really no clue what is going on.  I might also be grossly misunderstanding the entire concept of them!  I have read the supplied docs, and thought I understood, but really failed when trying to write my code.&lt;br&gt;
&lt;br&gt;
c) Also: in an application example in the GUI docs (&quot;simple_gui_2&quot;), there is a portion that says: &lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function popup_menu_Callback(source,eventdata) &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;% Determine the selected data set.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;str = get(source, 'String');&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;val = get(source,'Value');&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;% Set current data to the selected data set.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;switch str{val};&lt;br&gt;
&lt;br&gt;
now, what is this &quot;(source,eventdata)&quot; business going on in the code? &quot;source&quot; and &quot;eventdata&quot; don't appear to be defined/used anywhere else.  I tried searching in the Help and it did not make sense to me. Any more-plain-English explanations would be greatly appreciated!&lt;br&gt;
&lt;br&gt;
I apologize if a similar thread has already been resolved and I just didn't come across it. Please feel free to link me to any other relevant threads. Thank you very much!!</description>
    </item>
    <item>
      <pubDate>Fri, 06 Nov 2009 21:18:53 -0500</pubDate>
      <title>Re: How to activate other callbacks only when a pushbutton is </title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265203#692792</link>
      <author>Nathan</author>
      <description>On Nov 6, 1:12&#160;pm, &quot;Rachel Laughs&quot; &amp;lt;remove.thisrachellau...@gmail.com&amp;gt;&lt;br&gt;
wrote:&lt;br&gt;
&amp;gt; I am creating my first GUI in MATLAB. I prefer to do this programmatically.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I have an initial figure/panel/menu thing set up with 3 interactive components:&lt;br&gt;
&amp;gt; 1. user is asked to enter in a filename, which will be loaded&lt;br&gt;
&amp;gt; 2. user is asked to select an item from a pop-up menu&lt;br&gt;
&amp;gt; 3. OK button to confirm choices and move on (aka intialize callbacks of parts 1 and 2)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; a) How do you associate the callbacks of the first two parts to the third, so that only when the &quot;OK&quot; button is pushed does the other callbacks occur?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I tried to do this as 2 functions embedded in the push-button function, but I get the error &quot;undefined function or method...for input arguments&quot; which I am assuming is because this type of subfunction isn't allowed. &#160;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; b) How do I take the entered string value from the edit uicontrol box (component 1) and have the callback function load this as a file?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; When I start messing with callbacks, I have really no clue what is going on. &#160;I might also be grossly misunderstanding the entire concept of them! &#160;I have read the supplied docs, and thought I understood, but really failed when trying to write my code.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; c) Also: in an application example in the GUI docs (&quot;simple_gui_2&quot;), there is a portion that says:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &#160; &#160; &#160; function popup_menu_Callback(source,eventdata)&lt;br&gt;
&amp;gt; &#160; &#160; &#160; &#160; &#160;% Determine the selected data set.&lt;br&gt;
&amp;gt; &#160; &#160; &#160; &#160; &#160;str = get(source, 'String');&lt;br&gt;
&amp;gt; &#160; &#160; &#160; &#160; &#160;val = get(source,'Value');&lt;br&gt;
&amp;gt; &#160; &#160; &#160; &#160; &#160;% Set current data to the selected data set.&lt;br&gt;
&amp;gt; &#160; &#160; &#160; &#160; &#160;switch str{val};&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; now, what is this &quot;(source,eventdata)&quot; business going on in the code? &quot;source&quot; and &quot;eventdata&quot; don't appear to be defined/used anywhere else. &#160;I tried searching in the Help and it did not make sense to me. Any more-plain-English explanations would be greatly appreciated!&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I apologize if a similar thread has already been resolved and I just didn't come across it. Please feel free to link me to any other relevant threads. Thank you very much!!&lt;br&gt;
&lt;br&gt;
I can't be of much help here other than pointing you to a set of&lt;br&gt;
programmable gui examples submitted by Matt Fig:&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/24861-35-complete-gui-examples&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/24861-35-complete-gui-examples&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Good luck. I'm sure there is plenty you will learn from those.&lt;br&gt;
&lt;br&gt;
-Nathan</description>
    </item>
    <item>
      <pubDate>Fri, 06 Nov 2009 21:25:04 -0500</pubDate>
      <title>Re: How to activate other callbacks only when a pushbutton is</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265203#692794</link>
      <author>Rachel Laughs</author>
      <description>Nathan &amp;lt;ngreco32@gmail.com&amp;gt; wrote in message &amp;lt;1b27c717-b522-4a38-b724-3dcb74f03959@13g2000prl.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I can't be of much help here other than pointing you to a set of&lt;br&gt;
&amp;gt; programmable gui examples submitted by Matt Fig:&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/24861-35-complete-gui-examples&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/24861-35-complete-gui-examples&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Good luck. I'm sure there is plenty you will learn from those.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -Nathan&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Thanks for the quick response! and Wow, what a treasure chest of examples!  I had been having trouble finding suitable examples all day, so resorted to posting here. I had even been hoping that the infamous Matt Fig could provide some feedback for me, so I'm sure you are correct in that I will learn a lot from that link.&lt;br&gt;
&lt;br&gt;
Thanks again!</description>
    </item>
  </channel>
</rss>

