<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238273</link>
    <title>MATLAB Central Newsreader - counting mouse clicks</title>
    <description>Feed for thread: counting mouse clicks</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>Mon, 27 Oct 2008 22:55:04 -0400</pubDate>
      <title>counting mouse clicks</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238273#607628</link>
      <author>Julien </author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
I want to get the number of clicks I made in a plot by using the buttondownfcn callback, but I don't know how to implement the count variable back to the main function:&lt;br&gt;
&lt;br&gt;
function mousecount&lt;br&gt;
&amp;nbsp;&lt;br&gt;
count=0;&lt;br&gt;
axes('buttondownfcn',{@click,count});&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function click(gcbo,eventdata,count)&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;count=count+1;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;disp(count);&lt;br&gt;
&lt;br&gt;
...?&lt;br&gt;
&lt;br&gt;
Thanks for the help,&lt;br&gt;
&lt;br&gt;
Julien</description>
    </item>
    <item>
      <pubDate>Mon, 03 Nov 2008 15:02:01 -0500</pubDate>
      <title>Re: counting mouse clicks</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238273#608720</link>
      <author>Husam Aldahiyat</author>
      <description>What I do is put an invisible text in the GUI ('visible','off') and set its string to 0 ('string','0').&lt;br&gt;
&lt;br&gt;
Then in the buttondownfcn, get the number from the text, increment it, and put the new value in its place. That way I don't have to worry about globals and whatnot.&lt;br&gt;
&lt;br&gt;
Maybe there' a simpler way but this is fast and it works nice.</description>
    </item>
  </channel>
</rss>

