getting coordinates from gui axes

34 views (last 30 days)
micpro on 27 Jan 2017
Commented: micpro on 27 Jan 2017
I work with a GUI includes axes ( matlab2016a ),
I already activated the datacursor in gui side (from toolbar),
I can see coordinates when I click to graph,
But I want to get coordinates of mouse click, I mean reading the values, x and y,
I try with cp = get(gca,'CurrentPoint');
Does not work.
Can anyone help?
  1 Comment
Adam on 27 Jan 2017
What aspect of get( gca, 'CurrentPoint' ) 'doesn't work'?

Sign in to comment.

Answers (1)

Purushottama Rao
Purushottama Rao on 27 Jan 2017
Edited: Purushottama Rao on 27 Jan 2017
You can use one of these commands to read the data on mouse click.
[x, y] = getpts(fig)
[x, y] = getpts(ax)
micpro on 27 Jan 2017
Thanks, I get it.
Is it possible using 'enter' by commands? I mean via code?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!