How can I plot multiple columns from multiple files using plot?

2 vues (au cours des 30 derniers jours)
Suchetana Gupta
Suchetana Gupta le 21 Mai 2015
Commenté : Suchetana Gupta le 22 Mai 2015
I have four .dat files each containing three columns. The first column is supposed to be my data for X-axis whereas the second and third columns shall be the Y axis values. In each file the total number of X-axis values are different (but range is similar). However, I want to plot all the Y-axes values from all files against the X-axis in a single graph. Can you please provide a way to do so? Thanks

Réponse acceptée

Thorsten
Thorsten le 21 Mai 2015
Modifié(e) : Thorsten le 21 Mai 2015
That's straightforward, given that D1 is your N*3 file
plot(D1(:,1), D1(:,2:3)')
hold on
Load another data D2
plot(D2(:,1), D2(:,2:3)')
and so on.
  1 commentaire
Suchetana Gupta
Suchetana Gupta le 22 Mai 2015
Thanks. It did occur. But for two data sets I got the same colour plot (for two sets of values. I can differentiate on inspection). Is it possible to change colour? Also, is it possible to add colour label? Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by