How to plot three X & Y sets of points on the one graph from a text file

2 ビュー (過去 30 日間)
Daniel Lardner
Daniel Lardner 2021 年 7 月 30 日
コメント済み: Matt J 2021 年 8 月 1 日
Hello,
I would like to know if there is a better way to plot three sets of data points on the same graph than what I have currently done. I am getting the points from the text file Ifile. Also I have not plotted the time that is associated with the x & y co-ordinates as I am unsure how to add this with each x & y set and how it would be displayed. This code works but seems a little clumsy, so I'm open to suggestions.
x = Ifile(:,2);
xx = Ifile(:,4);
xxx = Ifile(:,6);
y = Ifile(:,3);
yy = Ifile(:,5);
yyy = Ifile(:,7);
plot(x,y,xx,yy,xxx,yyy)

回答 (1 件)

Matt J
Matt J 2021 年 7 月 30 日
plot( Ifile(:,[2,4,6]) , Ifile(:,[3,5,7]) )
  1 件のコメント
Matt J
Matt J 2021 年 8 月 1 日
Daniel Lardner on 31 Jul 2021 at 9:15
Hi MattJ,
Yes I see that makes sense and is much cleaner.
Also, could you shed some light in how I would plot the time?
Obviously each x & y position has a time associated with it, however I not sure what to do if the data is not a pair as it is when plotting just x & y coordinates.

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

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by