MATLAB Answers


How to register where the mouse button is pressed?

Asked by Teemu
on 21 Feb 2013

Hi! I have picture and I want to know where the mouse button is pressed. For example in picture there are some objects and I want to know if I press a button on the object. How can I do it? I appreciate your help.



No products are associated with this question.

1 Answer

Answer by Sean de Wolski
on 21 Feb 2013
 Accepted answer

Set The object's ButtonDownFcn to register the event and get the axes' 'CurrentPoint' if you need more information about where. I recommend getting started here:


Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!