How can I find mouse position on axes image?
15 views (last 30 days)
Show older comments
Hi, I read an image in Axes object GUI. And After I want to find mouse(x,y) coordinate on axes image.( Mousemove event) Thanks
0 Comments
Answers (1)
Star Strider
on 15 Jan 2016
1 Comment
Mike Garrity
on 15 Jan 2016
get(gca,'CurrentPoint')
It returns a 2x3 array because the axes actually shows a 3D volume. The first row is the point at the back of the volume, while the second row is the point at the front of the volume. In 2D the X & Y will be the same for both rows, you can just take the 1st row like this:
cpt = get(gca,'CurrentPoint')
pt = cpt(1,1:2)
See Also
Categories
Find more on Visual Exploration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!