How to plot a single collection of points

40 ビュー (過去 30 日間)
Zach Norris
Zach Norris 2017 年 4 月 18 日
コメント済み: Michael 2023 年 10 月 24 日
I have only been using Matlab for a month or so, so I don't really know much. I have a single collection of points where I am storing the x and y coordinates as pairs.
The points: X = {[1; 1], [1; 4], [4; 4], [4; 1]};
All I want to know is how I plot this, it seems simple, but I haven't had any luck. Thanks in advance.
  1 件のコメント
Michael
Michael 2023 年 10 月 24 日
Is this the real zach norris

サインインしてコメントする。

採用された回答

Andrew Newell
Andrew Newell 2017 年 4 月 18 日
You need to separate the x and y coordinates. Here is one solution:
data = [X{:}];
xdata = data(1,:); ydata = data(2,:)
plot(xdata,ydata,'-*')
axis([0.9 4.1 0.9 4.1])
I have modified the axes because otherwise you can't see the lines for the axes.
  1 件のコメント
Zach Norris
Zach Norris 2017 年 4 月 19 日
Perfect, thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by