Get coordinates to point

조회 수: 2 (최근 30일)
Ole
Ole 2014년 3월 5일
답변: Giorgos Papakonstantinou 2014년 3월 5일
Hi
Is there a function to get the coordinates to a point plotted in a figure? Im plotting two points separately in a figure, using the data cursor to get the coordinates of the two points, and then plotting a straight line between them.
To plot a line between the points i use
plot([x1,x2],[y1,y2])
with the coordinates from the data cursor.
Would be easier to use a call which extracts the coordinates after each point plotted, and then plotting the line between, and use this in my script.
Thanks
  댓글 수: 1
Matt J
Matt J 2014년 3월 5일
Why not plot all points at once?

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

답변 (1개)

Giorgos Papakonstantinou
Giorgos Papakonstantinou 2014년 3월 5일
h = plot([x1,x2],[y1,y2])
x = get(h, 'xdata') % the x values
y = get(h, 'ydata') % the y values

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by