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

Adam
Adam 2017년 1월 27일
What aspect of get( gca, 'CurrentPoint' ) 'doesn't work'?

댓글을 달려면 로그인하십시오.

답변 (1개)

Purushottama Rao
Purushottama Rao 2017년 1월 27일
편집: Purushottama Rao 2017년 1월 27일

1 개 추천

You can use one of these commands to read the data on mouse click.
[x, y] = getpts(fig)
or
[x, y] = getpts(ax)

댓글 수: 3

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

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

질문:

2017년 1월 27일

댓글:

2017년 1월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by