<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Continuous slider callback</title>
	<atom:link href="http://undocumentedmatlab.com/blog/continuous-slider-callback/feed/" rel="self" type="application/rss+xml" />
	<link>http://undocumentedmatlab.com/blog/continuous-slider-callback/</link>
	<description>Charting Matlab's unsupported hidden underbelly</description>
	<lastBuildDate>Thu, 09 Sep 2010 11:59:30 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Cemil Kirbas</title>
		<link>http://undocumentedmatlab.com/blog/continuous-slider-callback/comment-page-1/#comment-10644</link>
		<dc:creator>Cemil Kirbas</dc:creator>
		<pubDate>Wed, 02 Jun 2010 13:59:23 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1052#comment-10644</guid>
		<description>Thank you very much Yair. That was a great help. I changed HandleVisibility of the figure from its default value &#039;callback&#039; to &#039;on&#039; and the problem is solved. I appreciate your help.

Best regards,

Cemil.</description>
		<content:encoded><![CDATA[<p>Thank you very much Yair. That was a great help. I changed HandleVisibility of the figure from its default value &#8216;callback&#8217; to &#8216;on&#8217; and the problem is solved. I appreciate your help.</p>
<p>Best regards,</p>
<p>Cemil.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yair Altman</title>
		<link>http://undocumentedmatlab.com/blog/continuous-slider-callback/comment-page-1/#comment-10610</link>
		<dc:creator>Yair Altman</dc:creator>
		<pubDate>Tue, 01 Jun 2010 19:06:47 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1052#comment-10610</guid>
		<description>@Cemil - this could be due to several reasons: My bet is that your figure has a hidden handle (&lt;b&gt;HandleVisibility&lt;/b&gt;=&#039;off&#039;) and in your callback function you are using the &lt;i&gt;&lt;b&gt;gcf&lt;/b&gt;&lt;/i&gt; function or some other similar function that creates a new figure in such cases. Instead, use the actual figure handle that is available in your handles struct and ensure that you pass this handle to every function that could possibly need it (&lt;i&gt;&lt;b&gt;axes&lt;/b&gt;&lt;/i&gt; etc.).</description>
		<content:encoded><![CDATA[<p>@Cemil &#8211; this could be due to several reasons: My bet is that your figure has a hidden handle (<b>HandleVisibility</b>=&#8217;off&#8217;) and in your callback function you are using the <i><b>gcf</b></i> function or some other similar function that creates a new figure in such cases. Instead, use the actual figure handle that is available in your handles struct and ensure that you pass this handle to every function that could possibly need it (<i><b>axes</b></i> etc.).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cemil Kirbas</title>
		<link>http://undocumentedmatlab.com/blog/continuous-slider-callback/comment-page-1/#comment-10609</link>
		<dc:creator>Cemil Kirbas</dc:creator>
		<pubDate>Tue, 01 Jun 2010 18:57:09 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1052#comment-10609</guid>
		<description>Hi,

I created a GUI using guide with two sliders to adjust image window and level. When I use &lt;i&gt;&lt;b&gt;setappdata&lt;/b&gt;&lt;/i&gt; to my slider object a new figure is created when I started to use the slider.  My image is displayed in the new figure instead of my current GUI figure. Any idea why this is happening. Your help is appreciated. Thanks.

Cemil</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I created a GUI using guide with two sliders to adjust image window and level. When I use <i><b>setappdata</b></i> to my slider object a new figure is created when I started to use the slider.  My image is displayed in the new figure instead of my current GUI figure. Any idea why this is happening. Your help is appreciated. Thanks.</p>
<p>Cemil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yair Altman</title>
		<link>http://undocumentedmatlab.com/blog/continuous-slider-callback/comment-page-1/#comment-8931</link>
		<dc:creator>Yair Altman</dc:creator>
		<pubDate>Mon, 12 Apr 2010 05:13:23 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1052#comment-8931</guid>
		<description>Much obliged, Janos :-)

Positive feedback such as yours is very important for me when I have to explain to my family why I spend so much time on this website, for no apparent benefit...</description>
		<content:encoded><![CDATA[<p>Much obliged, Janos <img src='http://undocumentedmatlab.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Positive feedback such as yours is very important for me when I have to explain to my family why I spend so much time on this website, for no apparent benefit&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Janos Marki</title>
		<link>http://undocumentedmatlab.com/blog/continuous-slider-callback/comment-page-1/#comment-8925</link>
		<dc:creator>Janos Marki</dc:creator>
		<pubDate>Sun, 11 Apr 2010 22:41:09 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1052#comment-8925</guid>
		<description>Thanks again, I even ended up using the &quot;Donate&quot; button. I don&#039;t do that often, so you can be sure of seeing me here again!</description>
		<content:encoded><![CDATA[<p>Thanks again, I even ended up using the &#8220;Donate&#8221; button. I don&#8217;t do that often, so you can be sure of seeing me here again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yair Altman</title>
		<link>http://undocumentedmatlab.com/blog/continuous-slider-callback/comment-page-1/#comment-8915</link>
		<dc:creator>Yair Altman</dc:creator>
		<pubDate>Sun, 11 Apr 2010 12:25:41 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1052#comment-8915</guid>
		<description>Glad to help - that&#039;s what I&#039;m here for... 

The most difficult questions sometimes have very simple solutions, as in this case</description>
		<content:encoded><![CDATA[<p>Glad to help &#8211; that&#8217;s what I&#8217;m here for&#8230; </p>
<p>The most difficult questions sometimes have very simple solutions, as in this case</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Janos Marki</title>
		<link>http://undocumentedmatlab.com/blog/continuous-slider-callback/comment-page-1/#comment-8914</link>
		<dc:creator>Janos Marki</dc:creator>
		<pubDate>Sun, 11 Apr 2010 12:21:21 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1052#comment-8914</guid>
		<description>@Yair:
I see, makes sense! I put your 2 lines of code into my function&#039;s OpeningFcn, the Callback function back at the bottom of the main GUI .m-file and it all works now, thanks! Sorry for polluting the thread with such a looooong entry! :-)</description>
		<content:encoded><![CDATA[<p>@Yair:<br />
I see, makes sense! I put your 2 lines of code into my function&#8217;s OpeningFcn, the Callback function back at the bottom of the main GUI .m-file and it all works now, thanks! Sorry for polluting the thread with such a looooong entry! <img src='http://undocumentedmatlab.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yair Altman</title>
		<link>http://undocumentedmatlab.com/blog/continuous-slider-callback/comment-page-1/#comment-8913</link>
		<dc:creator>Yair Altman</dc:creator>
		<pubDate>Sun, 11 Apr 2010 11:43:37 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1052#comment-8913</guid>
		<description>@Janos - &lt;i&gt;hListener&lt;/i&gt;=&lt;b&gt;&lt;i&gt;handle.listener&lt;/i&gt;&lt;/b&gt; requires you to store the returned &lt;i&gt;hListener&lt;/i&gt; handle somewhere - the listener only works as long as its handle is stored somewhere. A good place to store this listener is in the target object&#039;s &lt;b&gt;ApplicationData&lt;/b&gt;, using the built-in &lt;b&gt;&lt;i&gt;setappdata&lt;/i&gt;&lt;/b&gt; function:

&lt;pre lang=&quot;matlab&quot;&gt;
hListener=handle.listener(handles.slider1,&#039;ActionEvent&#039;,@updatetextbox);
setappdata(handles.slider1,&#039;myListener&#039;,hListener);
&lt;/pre&gt;

You can do this in your main code - no need to use the Command Window. The reason it worked for you in the Command Window is that the &lt;b&gt;&lt;i&gt;handle.listener&lt;/i&gt;&lt;/b&gt; result was kept in the &lt;i&gt;ans&lt;/i&gt; variable, so as long as &lt;i&gt;ans&lt;/i&gt; was not changed the listener worked.</description>
		<content:encoded><![CDATA[<p>@Janos &#8211; <i>hListener</i>=<b><i>handle.listener</i></b> requires you to store the returned <i>hListener</i> handle somewhere &#8211; the listener only works as long as its handle is stored somewhere. A good place to store this listener is in the target object&#8217;s <b>ApplicationData</b>, using the built-in <b><i>setappdata</i></b> function:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">hListener=<span style="color: #0000FF;">handle.<span style="">listener</span></span><span style="color: #080;">&#40;</span>handles.<span style="">slider1</span>,<span style="color:#A020F0;">'ActionEvent'</span>,@updatetextbox<span style="color: #080;">&#41;</span>;
<span style="color: #0000FF;">setappdata</span><span style="color: #080;">&#40;</span>handles.<span style="">slider1</span>,<span style="color:#A020F0;">'myListener'</span>,hListener<span style="color: #080;">&#41;</span>;</pre></div></div>

<p>You can do this in your main code &#8211; no need to use the Command Window. The reason it worked for you in the Command Window is that the <b><i>handle.listener</i></b> result was kept in the <i>ans</i> variable, so as long as <i>ans</i> was not changed the listener worked.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Janos Marki</title>
		<link>http://undocumentedmatlab.com/blog/continuous-slider-callback/comment-page-1/#comment-8910</link>
		<dc:creator>Janos Marki</dc:creator>
		<pubDate>Sun, 11 Apr 2010 10:57:50 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1052#comment-8910</guid>
		<description>So in the post above, I tried implementing handle.listener at the Opening_Fcn and the main function level. Last option is outside the function, at the command prompt level. And this is what I do...

&lt;pre lang=&quot;matlab&quot;&gt;

&gt;&gt; ni=untitled

ni =

  173.0035

&gt;&gt; handles=guidata(ni)

handles = 

    figure1: 173.0035
      text1: 1.0059
    slider1: 174.0031
     output: 173.0035

&gt;&gt; handle.listener(handles.slider1,&#039;ActionEvent&#039;,@updatetextbox);

% *** Now try moving the slider ***
% YES, IT WORKS, we get to updatetextbox...
% So what arguments did updatetextbox get?

K&gt;&gt; varargin

varargin = 

    [1x1 uicontrol]    [1x1 handle.EventData]

&lt;/pre&gt;
Right, great news. So to do this, now I need a callback function of this form:
&lt;pre lang=&quot;matlab&quot;&gt;
function updatetextbox(hObject, eventdata, handles)
handles=guidata(hObject);
slidval=get(handles.slider1,&#039;Value&#039;);
set(handles.text1,&#039;String&#039;,num2str(slidval));
 &lt;/pre&gt;
And this finally works!!

Phew. Now, on to the &quot;interesting&quot; question. How can I &quot;package&quot; this up into the GUI itself (which was, as said, created by GUIDE, so I can&#039;t just put the listener line after the creation of a uicontrol object. Using a script, which launches the GUI, then contains the above commands in chronographical order?

In fact, question no. 2:
I chose GUIDE because the fact of not having to set uicontrol object positions and sizes by coding but graphically is very easy and fast for me. Was that silly, and is that the reason for all the above suffering? (i.e. once one needs something past very basic funtionality - e.g. continuous slider callback - GUIDE is NOT the way to go? 
 
In case there WAS anyone who followed through my &quot;troubleshooting&quot;, thanks, any further advice for a noob like me highly welcome.

Cheers,
Janos
Last bit of info:
I based this on the function untitled.m (and the associated saved untitled.fig) from here:
http://www.mathworks.com/support/solutions/en/data/1-3SR0YI/index.html?product=ML&amp;solution=1-3SR0YI

Which is supposed to be a solution for exactly this problem. On its own, it did not work, and that is when I tried implementing your solutions (though it is supposed to be what I am looking for, i.e. continuous slider callback from within a GUIDE-created GUI)</description>
		<content:encoded><![CDATA[<p>So in the post above, I tried implementing handle.listener at the Opening_Fcn and the main function level. Last option is outside the function, at the command prompt level. And this is what I do&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">&nbsp;
&gt;&gt; ni=untitled
&nbsp;
ni =
&nbsp;
  <span style="color: #33f;">173.0035</span>
&nbsp;
&gt;&gt; handles=guidata<span style="color: #080;">&#40;</span>ni<span style="color: #080;">&#41;</span>
&nbsp;
handles = 
&nbsp;
    figure1<span style="color: #F0F;">:</span> <span style="color: #33f;">173.0035</span>
      text1<span style="color: #F0F;">:</span> <span style="color: #33f;">1.0059</span>
    slider1<span style="color: #F0F;">:</span> <span style="color: #33f;">174.0031</span>
     output<span style="color: #F0F;">:</span> <span style="color: #33f;">173.0035</span>
&nbsp;
&gt;&gt; <span style="color: #0000FF;">handle.<span style="">listener</span></span><span style="color: #080;">&#40;</span>handles.<span style="">slider1</span>,<span style="color:#A020F0;">'ActionEvent'</span>,@updatetextbox<span style="color: #080;">&#41;</span>;
&nbsp;
<span style="color: #228B22;">% *** Now try moving the slider ***</span>
<span style="color: #228B22;">% YES, IT WORKS, we get to updatetextbox...</span>
<span style="color: #228B22;">% So what arguments did updatetextbox get?</span>
&nbsp;
K&gt;&gt; <span style="color: #0000FF;">varargin</span>
&nbsp;
<span style="color: #0000FF;">varargin</span> = 
&nbsp;
    <span style="color: #080;">&#91;</span>1x1 <span style="color: #0000FF;">uicontrol</span><span style="color: #080;">&#93;</span>    <span style="color: #080;">&#91;</span>1x1 handle.<span style="">EventData</span><span style="color: #080;">&#93;</span></pre></div></div>

<p>Right, great news. So to do this, now I need a callback function of this form:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;"><span style="color: #0000FF;">function</span> updatetextbox<span style="color: #080;">&#40;</span>hObject, eventdata, handles<span style="color: #080;">&#41;</span>
handles=guidata<span style="color: #080;">&#40;</span>hObject<span style="color: #080;">&#41;</span>;
slidval=<span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>handles.<span style="">slider1</span>,<span style="color:#A020F0;">'Value'</span><span style="color: #080;">&#41;</span>;
<span style="color: #0000FF;">set</span><span style="color: #080;">&#40;</span>handles.<span style="">text1</span>,<span style="color:#A020F0;">'String'</span>,<span style="color: #0000FF;">num2str</span><span style="color: #080;">&#40;</span>slidval<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>;</pre></div></div>

<p>And this finally works!!</p>
<p>Phew. Now, on to the &#8220;interesting&#8221; question. How can I &#8220;package&#8221; this up into the GUI itself (which was, as said, created by GUIDE, so I can&#8217;t just put the listener line after the creation of a uicontrol object. Using a script, which launches the GUI, then contains the above commands in chronographical order?</p>
<p>In fact, question no. 2:<br />
I chose GUIDE because the fact of not having to set uicontrol object positions and sizes by coding but graphically is very easy and fast for me. Was that silly, and is that the reason for all the above suffering? (i.e. once one needs something past very basic funtionality &#8211; e.g. continuous slider callback &#8211; GUIDE is NOT the way to go? </p>
<p>In case there WAS anyone who followed through my &#8220;troubleshooting&#8221;, thanks, any further advice for a noob like me highly welcome.</p>
<p>Cheers,<br />
Janos<br />
Last bit of info:<br />
I based this on the function untitled.m (and the associated saved untitled.fig) from here:<br />
<a href="http://www.mathworks.com/support/solutions/en/data/1-3SR0YI/index.html?product=ML&#038;solution=1-3SR0YI" rel="nofollow">http://www.mathworks.com/support/solutions/en/data/1-3SR0YI/index.html?product=ML&#038;solution=1-3SR0YI</a></p>
<p>Which is supposed to be a solution for exactly this problem. On its own, it did not work, and that is when I tried implementing your solutions (though it is supposed to be what I am looking for, i.e. continuous slider callback from within a GUIDE-created GUI)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Janos Marki</title>
		<link>http://undocumentedmatlab.com/blog/continuous-slider-callback/comment-page-1/#comment-8908</link>
		<dc:creator>Janos Marki</dc:creator>
		<pubDate>Sun, 11 Apr 2010 10:29:17 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1052#comment-8908</guid>
		<description>Trying to break it down a little more. Trying to put it into fnname_OpeningFcn, nothing happens on the slider movement event:

&lt;pre lang=&quot;matlab&quot;&gt;

function untitled_OpeningFcn(hObject, eventdata, handles, varargin)

% Choose default command line output for untitled
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

set(handles.text1,&#039;String&#039;,get(handles.slider1,&#039;Value&#039;))

handle.listener(handles.slider1,&#039;ActionEvent&#039;,@updatetextbox);
%addlistener(handles.slider1,&#039;ActionEvent&#039;,@updatetextbox); %using this variation does not work, either
&lt;/pre&gt;

And updatetextbox looks like this in a separate file (i.e. once it registers a slide movement, execution should jump inside updatetextbox and give me keyboard access, so I can at least see what inputs it got - but it does not happen (probably because I defined the listener inside, at the OpeningFcn level?).
&lt;pre lang=&quot;matlab&quot;&gt;
function updatetextbox(varargin)
keyboard
slidval=get(handles.slider1,&#039;Value&#039;);
set(handles.text1,&#039;String&#039;,num2str(slidval));
&lt;/pre&gt;

If I define the listener in the main function, then there is a problem - it runs through a lot of times. I can catch one where the figure is plotted already (where varargout already exists), grab the handle, add the listener... and nothing happens (sigh).:

&lt;pre lang=&quot;matlab&quot;&gt;

function varargout = untitled(varargin)
% UNTITLED M-file for untitled.fig
%  *** standard comment section ***
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help untitled
% Last Modified by GUIDE v2.5 11-Apr-2010 01:31:27

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(&#039;gui_Name&#039;,       mfilename, ...
                   &#039;gui_Singleton&#039;,  gui_Singleton, ...
                   &#039;gui_OpeningFcn&#039;, @untitled_OpeningFcn, ...
                   &#039;gui_OutputFcn&#039;,  @untitled_OutputFcn, ...
                   &#039;gui_LayoutFcn&#039;,  [] , ...
                   &#039;gui_Callback&#039;,   []);
if nargin &amp;&amp; ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% *** ADDED MY BIT HERE!!! ***
if exist(&#039;varargout&#039;)==1       %stopping main function once figure is up
   handles=guidata(varargout{1});      %grabbing the handles structure
   handle.listener(handles.slider1,&#039;ActionEvent&#039;,@updatetextbox);  %adding listener
end
&lt;/pre&gt;
In this case, I think as the whole namespace disappears once this instance of the function runs through, the listener disappears with it, too.
(I&#039;ll post this now, and continue in the next)</description>
		<content:encoded><![CDATA[<p>Trying to break it down a little more. Trying to put it into fnname_OpeningFcn, nothing happens on the slider movement event:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">&nbsp;
<span style="color: #0000FF;">function</span> untitled_OpeningFcn<span style="color: #080;">&#40;</span>hObject, eventdata, handles, <span style="color: #0000FF;">varargin</span><span style="color: #080;">&#41;</span>
&nbsp;
<span style="color: #228B22;">% Choose default command line output for untitled</span>
handles.<span style="">output</span> = hObject;
&nbsp;
<span style="color: #228B22;">% Update handles structure</span>
guidata<span style="color: #080;">&#40;</span>hObject, handles<span style="color: #080;">&#41;</span>;
&nbsp;
<span style="color: #0000FF;">set</span><span style="color: #080;">&#40;</span>handles.<span style="">text1</span>,<span style="color:#A020F0;">'String'</span>,<span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>handles.<span style="">slider1</span>,<span style="color:#A020F0;">'Value'</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
&nbsp;
<span style="color: #0000FF;">handle.<span style="">listener</span></span><span style="color: #080;">&#40;</span>handles.<span style="">slider1</span>,<span style="color:#A020F0;">'ActionEvent'</span>,@updatetextbox<span style="color: #080;">&#41;</span>;
<span style="color: #228B22;">%addlistener(handles.slider1,'ActionEvent',@updatetextbox); %using this variation does not work, either</span></pre></div></div>

<p>And updatetextbox looks like this in a separate file (i.e. once it registers a slide movement, execution should jump inside updatetextbox and give me keyboard access, so I can at least see what inputs it got &#8211; but it does not happen (probably because I defined the listener inside, at the OpeningFcn level?).</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;"><span style="color: #0000FF;">function</span> updatetextbox<span style="color: #080;">&#40;</span><span style="color: #0000FF;">varargin</span><span style="color: #080;">&#41;</span>
<span style="color: #0000FF;">keyboard</span>
slidval=<span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>handles.<span style="">slider1</span>,<span style="color:#A020F0;">'Value'</span><span style="color: #080;">&#41;</span>;
<span style="color: #0000FF;">set</span><span style="color: #080;">&#40;</span>handles.<span style="">text1</span>,<span style="color:#A020F0;">'String'</span>,<span style="color: #0000FF;">num2str</span><span style="color: #080;">&#40;</span>slidval<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>;</pre></div></div>

<p>If I define the listener in the main function, then there is a problem &#8211; it runs through a lot of times. I can catch one where the figure is plotted already (where varargout already exists), grab the handle, add the listener&#8230; and nothing happens (sigh).:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">&nbsp;
<span style="color: #0000FF;">function</span> <span style="color: #0000FF;">varargout</span> = untitled<span style="color: #080;">&#40;</span><span style="color: #0000FF;">varargin</span><span style="color: #080;">&#41;</span>
<span style="color: #228B22;">% UNTITLED M-file for untitled.fig</span>
<span style="color: #228B22;">%  *** standard comment section ***</span>
<span style="color: #228B22;">% See also: GUIDE, GUIDATA, GUIHANDLES</span>
&nbsp;
<span style="color: #228B22;">% Edit the above text to modify the response to help untitled</span>
<span style="color: #228B22;">% Last Modified by GUIDE v2.5 11-Apr-2010 01:31:27</span>
&nbsp;
<span style="color: #228B22;">% Begin initialization code - DO NOT EDIT</span>
gui_Singleton = <span style="color: #33f;">1</span>;
gui_State = <span style="color: #0000FF;">struct</span><span style="color: #080;">&#40;</span><span style="color:#A020F0;">'gui_Name'</span>,       mfilename, <span style="color: #F0F;">...</span>
                   <span style="color:#A020F0;">'gui_Singleton'</span>,  gui_Singleton, <span style="color: #F0F;">...</span>
                   <span style="color:#A020F0;">'gui_OpeningFcn'</span>, @untitled_OpeningFcn, <span style="color: #F0F;">...</span>
                   <span style="color:#A020F0;">'gui_OutputFcn'</span>,  @untitled_OutputFcn, <span style="color: #F0F;">...</span>
                   <span style="color:#A020F0;">'gui_LayoutFcn'</span>,  <span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span> , <span style="color: #F0F;">...</span>
                   <span style="color:#A020F0;">'gui_Callback'</span>,   <span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>;
<span style="color: #0000FF;">if</span> <span style="color: #0000FF;">nargin</span> <span style="color: #F0F;">&amp;</span>amp;<span style="color: #F0F;">&amp;</span>amp; <span style="color: #0000FF;">ischar</span><span style="color: #080;">&#40;</span><span style="color: #0000FF;">varargin</span><span style="color: #080;">&#123;</span><span style="color: #33f;">1</span><span style="color: #080;">&#125;</span><span style="color: #080;">&#41;</span>
    gui_State.<span style="">gui_Callback</span> = str2func<span style="color: #080;">&#40;</span><span style="color: #0000FF;">varargin</span><span style="color: #080;">&#123;</span><span style="color: #33f;">1</span><span style="color: #080;">&#125;</span><span style="color: #080;">&#41;</span>;
<span style="color: #0000FF;">end</span>
&nbsp;
<span style="color: #0000FF;">if</span> <span style="color: #0000FF;">nargout</span>
    <span style="color: #080;">&#91;</span><span style="color: #0000FF;">varargout</span><span style="color: #080;">&#123;</span><span style="color: #33f;">1</span><span style="color: #F0F;">:</span><span style="color: #0000FF;">nargout</span><span style="color: #080;">&#125;</span><span style="color: #080;">&#93;</span> = gui_mainfcn<span style="color: #080;">&#40;</span>gui_State, <span style="color: #0000FF;">varargin</span><span style="color: #080;">&#123;</span><span style="color: #F0F;">:</span><span style="color: #080;">&#125;</span><span style="color: #080;">&#41;</span>;
<span style="color: #0000FF;">else</span>
    gui_mainfcn<span style="color: #080;">&#40;</span>gui_State, <span style="color: #0000FF;">varargin</span><span style="color: #080;">&#123;</span><span style="color: #F0F;">:</span><span style="color: #080;">&#125;</span><span style="color: #080;">&#41;</span>;
<span style="color: #0000FF;">end</span>
<span style="color: #228B22;">% End initialization code - DO NOT EDIT</span>
&nbsp;
<span style="color: #228B22;">% *** ADDED MY BIT HERE!!! ***</span>
<span style="color: #0000FF;">if</span> <span style="color: #0000FF;">exist</span><span style="color: #080;">&#40;</span><span style="color:#A020F0;">'varargout'</span><span style="color: #080;">&#41;</span>==<span style="color: #33f;">1</span>       <span style="color: #228B22;">%stopping main function once figure is up</span>
   handles=guidata<span style="color: #080;">&#40;</span><span style="color: #0000FF;">varargout</span><span style="color: #080;">&#123;</span><span style="color: #33f;">1</span><span style="color: #080;">&#125;</span><span style="color: #080;">&#41;</span>;      <span style="color: #228B22;">%grabbing the handles structure</span>
   <span style="color: #0000FF;">handle.<span style="">listener</span></span><span style="color: #080;">&#40;</span>handles.<span style="">slider1</span>,<span style="color:#A020F0;">'ActionEvent'</span>,@updatetextbox<span style="color: #080;">&#41;</span>;  <span style="color: #228B22;">%adding listener</span>
<span style="color: #0000FF;">end</span></pre></div></div>

<p>In this case, I think as the whole namespace disappears once this instance of the function runs through, the listener disappears with it, too.<br />
(I&#8217;ll post this now, and continue in the next)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
