getting coordinates from gui axes

Hi,
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?
Regards.

1 comentario

Adam
Adam el 27 de En. de 2017
What aspect of get( gca, 'CurrentPoint' ) 'doesn't work'?

Iniciar sesión para comentar.

Respuestas (1)

Purushottama Rao
Purushottama Rao el 27 de En. de 2017
Editada: Purushottama Rao el 27 de En. de 2017
You can use one of these commands to read the data on mouse click.
[x, y] = getpts(fig)
or
[x, y] = getpts(ax)

3 comentarios

micpro
micpro el 27 de En. de 2017
Thank you! Why it returns 12 values? How can I restrict it with only 1 or 2 value?
Purushottama Rao
Purushottama Rao el 27 de En. de 2017
Editada: Purushottama Rao el 27 de En. de 2017
You can use 'enter' after the selection of required number of data points.
micpro
micpro el 27 de En. de 2017
Thanks, I get it.
Is it possible using 'enter' by commands? I mean via code?

Iniciar sesión para comentar.

Categorías

Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.

Preguntada:

el 27 de En. de 2017

Comentada:

el 27 de En. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by