<?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: Practical Example: Adding callbacks to a plot</title>
	<atom:link href="http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/</link>
	<description>Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.</description>
	<lastBuildDate>Fri, 10 Feb 2012 20:31:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: dhull</title>
		<link>http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-1272</link>
		<dc:creator>dhull</dc:creator>
		<pubDate>Thu, 18 Dec 2008 16:29:31 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-1272</guid>
		<description>Vishrut,

You could add an annotation or change the title in the HighlightPair function to do this.  You can do whatever you want in these callbacks to enhance the visualization.

-Doug</description>
		<content:encoded><![CDATA[<p>Vishrut,</p>
<p>You could add an annotation or change the title in the HighlightPair function to do this.  You can do whatever you want in these callbacks to enhance the visualization.</p>
<p>-Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vishrut</title>
		<link>http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-1271</link>
		<dc:creator>Vishrut</dc:creator>
		<pubDate>Wed, 17 Dec 2008 22:33:11 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-1271</guid>
		<description>Hey Doug,

Really helpful post. Still have a question...Is there any way to show the number of entry on the plot...say I am plotting two plots using three arrays and I am interested in knowing where my first point (of all tree arrays) is on each chart! Is there any way to do it within this procedure?

Thanks,

Vishrut</description>
		<content:encoded><![CDATA[<p>Hey Doug,</p>
<p>Really helpful post. Still have a question&#8230;Is there any way to show the number of entry on the plot&#8230;say I am plotting two plots using three arrays and I am interested in knowing where my first point (of all tree arrays) is on each chart! Is there any way to do it within this procedure?</p>
<p>Thanks,</p>
<p>Vishrut</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-804</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Thu, 20 Mar 2008 15:45:46 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-804</guid>
		<description>Yonathan,

Two things are happening here:  There is a nested function, and a function handle.  The function handle (the @ symbol creates it) snapshots the workspace of the main function upon creation.  This is how the variable stay &quot;alive&quot;.  The scoping into the nested function is as discussed in my video.

Thanks for a great question!
Doug</description>
		<content:encoded><![CDATA[<p>Yonathan,</p>
<p>Two things are happening here:  There is a nested function, and a function handle.  The function handle (the @ symbol creates it) snapshots the workspace of the main function upon creation.  This is how the variable stay &#8220;alive&#8221;.  The scoping into the nested function is as discussed in my video.</p>
<p>Thanks for a great question!<br />
Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yonathan Nativ</title>
		<link>http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-803</link>
		<dc:creator>Yonathan Nativ</dc:creator>
		<pubDate>Thu, 20 Mar 2008 09:12:04 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-803</guid>
		<description>Hi Doug,

In your demo the main function has ended. I thought when the function ends all its variables die.

The nested function is called through a callback, why does the callback revive the main function?

Thanks again,

Yonathan</description>
		<content:encoded><![CDATA[<p>Hi Doug,</p>
<p>In your demo the main function has ended. I thought when the function ends all its variables die.</p>
<p>The nested function is called through a callback, why does the callback revive the main function?</p>
<p>Thanks again,</p>
<p>Yonathan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-802</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Wed, 19 Mar 2008 18:31:47 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-802</guid>
		<description>Yonathan,

hdd and hdp were in scope in the highlightPair function because it is a nested function and has access to the variables of the outer function.  See this video for more details:

http://blogs.mathworks.com/pick/2008/02/01/matlab-basics-nested-functions/

Thanks,
Doug</description>
		<content:encoded><![CDATA[<p>Yonathan,</p>
<p>hdd and hdp were in scope in the highlightPair function because it is a nested function and has access to the variables of the outer function.  See this video for more details:</p>
<p><a href="http://blogs.mathworks.com/pick/2008/02/01/matlab-basics-nested-functions/" rel="nofollow">http://blogs.mathworks.com/pick/2008/02/01/matlab-basics-nested-functions/</a></p>
<p>Thanks,<br />
Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yonathan Nativ</title>
		<link>http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-801</link>
		<dc:creator>Yonathan Nativ</dc:creator>
		<pubDate>Wed, 19 Mar 2008 18:15:39 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-801</guid>
		<description>Hi Doug,

Nice video, One question though:

How does the &quot;highlightPair&quot; function knows the variables hdd &amp; hdp?


Thanks,

Yonathan</description>
		<content:encoded><![CDATA[<p>Hi Doug,</p>
<p>Nice video, One question though:</p>
<p>How does the &#8220;highlightPair&#8221; function knows the variables hdd &amp; hdp?</p>
<p>Thanks,</p>
<p>Yonathan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-800</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Mon, 04 Feb 2008 18:35:32 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-800</guid>
		<description>plot(rand(1,10))
k = waitforbuttonpress;
point1 = get(gca,&#039;CurrentPoint&#039;)

This will get you the current point that you click on.  An example like this was done here:

http://blogs.mathworks.com/pick/2007/12/26/advanced-matlab-buttondownfcn/</description>
		<content:encoded><![CDATA[<p>plot(rand(1,10))<br />
k = waitforbuttonpress;<br />
point1 = get(gca,&#8217;CurrentPoint&#8217;)</p>
<p>This will get you the current point that you click on.  An example like this was done here:</p>
<p><a href="http://blogs.mathworks.com/pick/2007/12/26/advanced-matlab-buttondownfcn/" rel="nofollow">http://blogs.mathworks.com/pick/2007/12/26/advanced-matlab-buttondownfcn/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will</title>
		<link>http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-799</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Thu, 31 Jan 2008 16:56:05 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-799</guid>
		<description>Great Post, I always tried to do this but could never get it to work properly.

Is there a similar way to do this with a &#039;line&#039; instead of a &#039;point&#039;.  If I were to make a line with a ButtdownFnc is there a way I could get the (x,y) coordinates of the clicking?  I see that I could potentially plot each of the points individually as you did above, but it seems like there might be a more elegant way to do this.

Thanks</description>
		<content:encoded><![CDATA[<p>Great Post, I always tried to do this but could never get it to work properly.</p>
<p>Is there a similar way to do this with a &#8216;line&#8217; instead of a &#8216;point&#8217;.  If I were to make a line with a ButtdownFnc is there a way I could get the (x,y) coordinates of the clicking?  I see that I could potentially plot each of the points individually as you did above, but it seems like there might be a more elegant way to do this.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-798</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Tue, 29 Jan 2008 16:20:24 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-798</guid>
		<description>I am normally an advocate of SETAPPDATA, GETAPPDATA.  However, for this specific case I was storing a very small amount of data and this was a very easy way of doing this.

Thanks for adding to this with your technique.

Doug</description>
		<content:encoded><![CDATA[<p>I am normally an advocate of SETAPPDATA, GETAPPDATA.  However, for this specific case I was storing a very small amount of data and this was a very easy way of doing this.</p>
<p>Thanks for adding to this with your technique.</p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Markus</title>
		<link>http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-797</link>
		<dc:creator>Markus</dc:creator>
		<pubDate>Mon, 28 Jan 2008 21:40:21 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/28/practical-example-adding-callbacks-to-a-plot/#comment-797</guid>
		<description>I am glad you are using a technique I also use for GUIs, namely saving data in the &#039;userdata&#039; field of objects and/or the main figure. In my opinion this is much clearer then using handles to nested functions.

You can even store more information in the userdata field using a struct. It just needs some discipline and little more lines of code for adding or updating data:

str = get(gcf, &#039;userdata&#039;);
str.myfield = something;
set(gcf, &#039;userdata&#039;, str);

Markus</description>
		<content:encoded><![CDATA[<p>I am glad you are using a technique I also use for GUIs, namely saving data in the &#8216;userdata&#8217; field of objects and/or the main figure. In my opinion this is much clearer then using handles to nested functions.</p>
<p>You can even store more information in the userdata field using a struct. It just needs some discipline and little more lines of code for adding or updating data:</p>
<p>str = get(gcf, &#8216;userdata&#8217;);<br />
str.myfield = something;<br />
set(gcf, &#8216;userdata&#8217;, str);</p>
<p>Markus</p>
]]></content:encoded>
	</item>
</channel>
</rss>

