Get coordinates to point

4 ビュー (過去 30 日間)
Ole
Ole 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 Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by