<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Advanced MATLAB: Capture mouse movement</title>
	<link>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/</link>
	<description>Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.</description>
	<pubDate>Mon, 23 Nov 2009 00:41:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: dhull</title>
		<link>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-1666</link>
		<dc:creator>dhull</dc:creator>
		<pubDate>Tue, 10 Nov 2009 21:09:28 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-1666</guid>
		<description>@lucy,

With just this snippet, I can not really tell anything.

My guess is that the handles of the various objects you are using in the callbacks are going out of scope.  This is very common for people doing GUIs.  Go take a look at my second GUI video (next to oldest in the TOPIC GUI to right).

That might help, though it is not specific to this at all.

Doug</description>
		<content:encoded><![CDATA[<p>@lucy,</p>
<p>With just this snippet, I can not really tell anything.</p>
<p>My guess is that the handles of the various objects you are using in the callbacks are going out of scope.  This is very common for people doing GUIs.  Go take a look at my second GUI video (next to oldest in the TOPIC GUI to right).</p>
<p>That might help, though it is not specific to this at all.</p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lucy</title>
		<link>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-1659</link>
		<dc:creator>Lucy</dc:creator>
		<pubDate>Mon, 09 Nov 2009 14:37:20 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-1659</guid>
		<description>Hi Doug,

I’m learning how to create GUIs in Matlab and your GUI tutorials have really helped me. I would like to implement the above function for capturing mouse movement into a GUI, but I’m having lots of problems. At the moment I can’t even get the xdata line to appear. Please could you suggest how to go about implementing your code below into GUI form? Any hints would be very,very much appreciated!

************************************************************
function main
axes = handles.axes1
ah = axes('xlim',[0 1],'ylim',[0 1])
h = hLine([0.5 0.5], [0 1],...
    'color', 'red',...
    'linewidth', 3,...
    'ButtonDownFcn', @startDragFcn)

set(f, 'WindowButtonUpFcn', @stopDragFcn)
 
function startDragFcn(varargin)
set(f, 'WindowButtonMotionFcn',@dragginFcn)

    function dragginFcn(varargin)
        pt = get(aH, 'CurrentPoint')
        set(h, 'xData', pt(1)*[1 1])

    function stopDragFcn(varargin)
        set(f, 'WindowButtonMotionFcn','')
************************************************************

Many thanks

Lucy</description>
		<content:encoded><![CDATA[<p>Hi Doug,</p>
<p>I’m learning how to create GUIs in Matlab and your GUI tutorials have really helped me. I would like to implement the above function for capturing mouse movement into a GUI, but I’m having lots of problems. At the moment I can’t even get the xdata line to appear. Please could you suggest how to go about implementing your code below into GUI form? Any hints would be very,very much appreciated!</p>
<p>************************************************************<br />
function main<br />
axes = handles.axes1<br />
ah = axes(&#8217;xlim&#8217;,[0 1],&#8217;ylim&#8217;,[0 1])<br />
h = hLine([0.5 0.5], [0 1],&#8230;<br />
    &#8216;color&#8217;, &#8216;red&#8217;,&#8230;<br />
    &#8216;linewidth&#8217;, 3,&#8230;<br />
    &#8216;ButtonDownFcn&#8217;, @startDragFcn)</p>
<p>set(f, &#8216;WindowButtonUpFcn&#8217;, @stopDragFcn)</p>
<p>function startDragFcn(varargin)<br />
set(f, &#8216;WindowButtonMotionFcn&#8217;,@dragginFcn)</p>
<p>    function dragginFcn(varargin)<br />
        pt = get(aH, &#8216;CurrentPoint&#8217;)<br />
        set(h, &#8216;xData&#8217;, pt(1)*[1 1])</p>
<p>    function stopDragFcn(varargin)<br />
        set(f, &#8216;WindowButtonMotionFcn&#8217;,&#8221;)<br />
************************************************************</p>
<p>Many thanks</p>
<p>Lucy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fatih</title>
		<link>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-1650</link>
		<dc:creator>Fatih</dc:creator>
		<pubDate>Mon, 02 Nov 2009 06:49:57 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-1650</guid>
		<description>@Doug,

I forgot to write here but i find a solution to handle it. 

http://img682.imageshack.us/i/adszkh.jpg/


If someone need this i can send my program.


Fatih</description>
		<content:encoded><![CDATA[<p>@Doug,</p>
<p>I forgot to write here but i find a solution to handle it. </p>
<p><a href="http://img682.imageshack.us/i/adszkh.jpg/" rel="nofollow">http://img682.imageshack.us/i/adszkh.jpg/</a></p>
<p>If someone need this i can send my program.</p>
<p>Fatih</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dhull</title>
		<link>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-1649</link>
		<dc:creator>dhull</dc:creator>
		<pubDate>Fri, 30 Oct 2009 18:08:19 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-1649</guid>
		<description>@Fatih,

Good problem.  You will just have to make sure that when you set the XData on the original line, you also set it on all the additional lines.  You would want to put the callbacks on all the lines so that any of them can move.

Doug</description>
		<content:encoded><![CDATA[<p>@Fatih,</p>
<p>Good problem.  You will just have to make sure that when you set the XData on the original line, you also set it on all the additional lines.  You would want to put the callbacks on all the lines so that any of them can move.</p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fatih</title>
		<link>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-1646</link>
		<dc:creator>Fatih</dc:creator>
		<pubDate>Wed, 28 Oct 2009 14:15:40 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-1646</guid>
		<description>Great Work Doug! Thanks!

I have one question about that..

I want to do samething but not only one graph but also two or three subplots. I mean: i have 2-3 graphs in one figure, and i want to apply samethings to my whole graphs. 

Here is the screenshot. 

http://img21.imageshack.us/i/adszpu.jpg/

It seems work but i can adjust only one line. Another one didn't move. 

If i understand correctly i can expand this up to 10 graphs.

I am working on it but unfortunately i couldn't handle with it. 

If you could help me, i would be appreciated...

Thanks Again!</description>
		<content:encoded><![CDATA[<p>Great Work Doug! Thanks!</p>
<p>I have one question about that..</p>
<p>I want to do samething but not only one graph but also two or three subplots. I mean: i have 2-3 graphs in one figure, and i want to apply samethings to my whole graphs. </p>
<p>Here is the screenshot. </p>
<p><a href="http://img21.imageshack.us/i/adszpu.jpg/" rel="nofollow">http://img21.imageshack.us/i/adszpu.jpg/</a></p>
<p>It seems work but i can adjust only one line. Another one didn&#8217;t move. </p>
<p>If i understand correctly i can expand this up to 10 graphs.</p>
<p>I am working on it but unfortunately i couldn&#8217;t handle with it. </p>
<p>If you could help me, i would be appreciated&#8230;</p>
<p>Thanks Again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Örjan Henriksson</title>
		<link>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-1559</link>
		<dc:creator>Örjan Henriksson</dc:creator>
		<pubDate>Sun, 06 Sep 2009 05:52:30 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-1559</guid>
		<description>Hello Doug!

Many thanks for your excellent videos, it sure makes it easier for newbies like me to get into Matlab. However, I have a question, or actually a couple of questions...

My goal is to make a surface object and be able to change the surface Zdata by clicking and dragging. I have been looking through the documentation, the net and all books I could find, but I haven't been able to find anything that explains how to do that, except from this tutorial. Sure the documentation contains some hints, but I need more than that...

So far, I've found some examples that comes close on the File Exchange, namely 'gnurbs' by Daniel Claxton and 'moveplot' by by Brandon Kuczenski/Alex Woo.

One thing I don't understand is how to translate the axes 'CurrentPoint' property to determine which point of the surface is being clicked on.

Also, by looking at the above two examples, I've noticed that they copy the data to be manipulated to the axes 'userdata' property. Is this necessary, or is there any way to 'set' individual points of the surface objects Zdata property directly?

I understand you might not be able to give me a full answer, but maybe you know where I can learn some more about this?

Thanks again and keep up the good work!

Ö.H.</description>
		<content:encoded><![CDATA[<p>Hello Doug!</p>
<p>Many thanks for your excellent videos, it sure makes it easier for newbies like me to get into Matlab. However, I have a question, or actually a couple of questions&#8230;</p>
<p>My goal is to make a surface object and be able to change the surface Zdata by clicking and dragging. I have been looking through the documentation, the net and all books I could find, but I haven&#8217;t been able to find anything that explains how to do that, except from this tutorial. Sure the documentation contains some hints, but I need more than that&#8230;</p>
<p>So far, I&#8217;ve found some examples that comes close on the File Exchange, namely &#8216;gnurbs&#8217; by Daniel Claxton and &#8216;moveplot&#8217; by by Brandon Kuczenski/Alex Woo.</p>
<p>One thing I don&#8217;t understand is how to translate the axes &#8216;CurrentPoint&#8217; property to determine which point of the surface is being clicked on.</p>
<p>Also, by looking at the above two examples, I&#8217;ve noticed that they copy the data to be manipulated to the axes &#8216;userdata&#8217; property. Is this necessary, or is there any way to &#8217;set&#8217; individual points of the surface objects Zdata property directly?</p>
<p>I understand you might not be able to give me a full answer, but maybe you know where I can learn some more about this?</p>
<p>Thanks again and keep up the good work!</p>
<p>Ö.H.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Everest</title>
		<link>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-980</link>
		<dc:creator>Everest</dc:creator>
		<pubDate>Thu, 24 Jul 2008 13:18:57 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-980</guid>
		<description>Thanks Doug!

The problem is solved now.. Actually I've used UserData property to gave the name to  my 'figure',axis' and 'line' so I could call them in the external function (draggingFcn etc.)
However, it was not so obvious at the beginning.

Everest</description>
		<content:encoded><![CDATA[<p>Thanks Doug!</p>
<p>The problem is solved now.. Actually I&#8217;ve used UserData property to gave the name to  my &#8216;figure&#8217;,axis&#8217; and &#8216;line&#8217; so I could call them in the external function (draggingFcn etc.)<br />
However, it was not so obvious at the beginning.</p>
<p>Everest</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-979</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Fri, 18 Jul 2008 17:45:33 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-979</guid>
		<description>Everest,

I just did a quick check.  That version of MATLAB is about three years ago. There have been enough changes in function handles that I suspect that is the reason code written for the newer version of MATLAB does not work in an older version.

Doug</description>
		<content:encoded><![CDATA[<p>Everest,</p>
<p>I just did a quick check.  That version of MATLAB is about three years ago. There have been enough changes in function handles that I suspect that is the reason code written for the newer version of MATLAB does not work in an older version.</p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Everest</title>
		<link>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-978</link>
		<dc:creator>Everest</dc:creator>
		<pubDate>Thu, 17 Jul 2008 08:30:57 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-978</guid>
		<description>Hi!
This is really great!:] I've used this idea to move the data points on my plot. But here is my query:
the code works really great on Matlab 7.1, but when I run it on the older version (actually it is Matlab 6.1.0.450)
I get the following error:

********************************************************
??? Undefined function or variable 'f'.

Error in ==&#62; G:\MATLAB_61\MOUSE_CAPTURE\mouse_capt.m (startDragFcn)
On line 66  ==&#62;         set(f,'WindowButtonMotionFcn',@draggingFcn)

??? Error while evaluating line ButtonDownFcn.

??? Undefined function or variable 'f'.

Error in ==&#62; G:\MATLAB_61\MOUSE_CAPTURE\mouse_capt.m (stopDragFcn)
On line 128  ==&#62;         set(f, 'WindowButtonMotionFcn','')

??? Error while evaluating figure WindowButtonUpFcn.
********************************************************

Why is that? What to do to make it work on the older version?</description>
		<content:encoded><![CDATA[<p>Hi!<br />
This is really great!:] I&#8217;ve used this idea to move the data points on my plot. But here is my query:<br />
the code works really great on Matlab 7.1, but when I run it on the older version (actually it is Matlab 6.1.0.450)<br />
I get the following error:</p>
<p>********************************************************<br />
??? Undefined function or variable &#8216;f&#8217;.</p>
<p>Error in ==&gt; G:\MATLAB_61\MOUSE_CAPTURE\mouse_capt.m (startDragFcn)<br />
On line 66  ==&gt;         set(f,&#8217;WindowButtonMotionFcn&#8217;,@draggingFcn)</p>
<p>??? Error while evaluating line ButtonDownFcn.</p>
<p>??? Undefined function or variable &#8216;f&#8217;.</p>
<p>Error in ==&gt; G:\MATLAB_61\MOUSE_CAPTURE\mouse_capt.m (stopDragFcn)<br />
On line 128  ==&gt;         set(f, &#8216;WindowButtonMotionFcn&#8217;,&#8221;)</p>
<p>??? Error while evaluating figure WindowButtonUpFcn.<br />
********************************************************</p>
<p>Why is that? What to do to make it work on the older version?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tahim</title>
		<link>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-977</link>
		<dc:creator>Tahim</dc:creator>
		<pubDate>Tue, 01 Jul 2008 22:56:16 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/#comment-977</guid>
		<description>I was looking for an answer for this problem in matlab web page and I found the solution. When using the functions presented by the Doug (nice work Doug) all you have to do to use them inside your GUIs is to pass the handles of the GUI inside a cell.

When using additional arguments for the callback function, you must set the value of the property to a cell array (i.e., enclose the function handle and arguments in curly braces). For example,
You can define the callback function to accept additional input arguments by adding them to the function definition. For example,

function startDragFcn(src,eventdata,arg1)

arg1 is an additional argument. In my case I used the handles of the GUI as an additional argument:

function startDragFcn(hObject,eventdata,handles)

So, for the callback function you have to enclose the function handle and the additional arguments in curly braces. For example,

set(hLine,'ButtonDownFcn',{@startDragFcn,handles});
set(hFigure, 'WindowButtonUpFcn',{@stopDragFcn,handles});</description>
		<content:encoded><![CDATA[<p>I was looking for an answer for this problem in matlab web page and I found the solution. When using the functions presented by the Doug (nice work Doug) all you have to do to use them inside your GUIs is to pass the handles of the GUI inside a cell.</p>
<p>When using additional arguments for the callback function, you must set the value of the property to a cell array (i.e., enclose the function handle and arguments in curly braces). For example,<br />
You can define the callback function to accept additional input arguments by adding them to the function definition. For example,</p>
<p>function startDragFcn(src,eventdata,arg1)</p>
<p>arg1 is an additional argument. In my case I used the handles of the GUI as an additional argument:</p>
<p>function startDragFcn(hObject,eventdata,handles)</p>
<p>So, for the callback function you have to enclose the function handle and the additional arguments in curly braces. For example,</p>
<p>set(hLine,&#8217;ButtonDownFcn&#8217;,{@startDragFcn,handles});<br />
set(hFigure, &#8216;WindowButtonUpFcn&#8217;,{@stopDragFcn,handles});</p>
]]></content:encoded>
	</item>
</channel>
</rss>
