Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
counting mouse clicks

Subject: counting mouse clicks

From: Julien

Date: 27 Oct, 2008 22:55:04

Message: 1 of 2


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:

function mousecount
    function click(gcbo,eventdata,count)


Thanks for the help,


Subject: counting mouse clicks

From: Husam Aldahiyat

Date: 3 Nov, 2008 15:02:01

Message: 2 of 2

What I do is put an invisible text in the GUI ('visible','off') and set its string to 0 ('string','0').

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.

Maybe there' a simpler way but this is fast and it works nice.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us