How to display the x and y values of the cursor location on plot in GUIDE

조회 수: 24 (최근 30일)
Suppose I plot a graph on an axis in MATLAB GUIDE. How do I get two static text boxes to display the x and y values of the point my cursor is hovering over? I know this can be done to show the pixel coordinates in the GUI, but when it comes to a plot I am unsure.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2018년 10월 2일
Would this help?
doc datacursormode
  댓글 수: 4
Chamath Vithanawasam
Chamath Vithanawasam 2018년 10월 4일
That's quite alright, thanks for your help!
Fangjun Jiang
Fangjun Jiang 2018년 10월 4일
Ha, this might work
plot(rand(1,10),'o-')
[x,y]=ginput(1);
line([x x],ylim);
line(xlim,[y y]);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by