How to plot a matrix with reoccurring values?

1 回表示 (過去 30 日間)
Erick Magana
Erick Magana 2019 年 12 月 6 日
コメント済み: ME 2019 年 12 月 6 日
How would I be able to plot matrix with a reoccuring value such as:
[x y]
[x1 y]
[x1 y1]
[x y1]
[x y2]
[x1 y2]
[x1 y3]
[x y3]
where x=x, x1=x-some number, y=y, y1=y-some number, y2=y1-some number, y3=y-some number. I am trying to create a zig zag pattern onto a map using long and lat but do now really know how I would be able to plot it. I was thinking that it would be the same as plotting a regular matrix but am not sure if it the same values would affect the plot in a way that the points would not show up.

採用された回答

ME
ME 2019 年 12 月 6 日
Take for example a matrix:
vals = [1 1;2 1;2 2; 1 2; 1 3; 2 3; 2 4; 1 4];
which is of the form you describe above. Then do:
plot(vals(:,1),vals(:,2))
This gives the following output - is that about what you wanted?
output.png
  4 件のコメント
Erick Magana
Erick Magana 2019 年 12 月 6 日
Thank you so much it worked!!
ME
ME 2019 年 12 月 6 日
Not a problem. If you found this answer helpful, could you possibly accept it?

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

その他の回答 (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