Plot in a loop in matlab

1. May 19, 2012

mathia

Hi,
I have a matrix for instance as follow:
A=[0.087 11.43 17.14 22.86 28.57 34.29 40.00 45.72 51.43 57.15
0.174 5.671 8.506 11.34 14.17 17.01 19.84 22.68 25.52 28.35
0.261 3.732 5.598 7.464 9.330 11.19 13.06 14.92 16.79 18.66
0.349 2.747 4.121 5.494 6.868 8.242 9.616 10.98 12.36 13.73
0.436 2.144 3.216 4.289 5.361 6.433 7.505 8.578 9.650 10.72
0.523 1.732 2.598 3.464 4.330 5.196 6.062 6.928 7.794 8.660];

I want to have all of this plot:
hold all
plot(A(:,1),A(:,2))
plot(A(:,1),A(:,3))
plot(A(:,1),A(:,4))
plot(A(:,1),A(:,5))
plot(A(:,1),A(:,6))
plot(A(:,1),A(:,7))
plot(A(:,1),A(:,8))
plot(A(:,1),A(:,9))
plot(A(:,1),A(:,10))

Can I have all of those plot just by using one plot command in a loop? If this is the case how can I do?
Thank you.
Best Regards,
Mathias

2. May 19, 2012

Dr Transport

are they separate plots?? if not overlaying them is accomplished by

Code (Text):
for i = 2:10

plot(A(;,1),A(:,i));
hold on;

end
hold off;

3. May 20, 2012

mathia

thank you.
yes, they are separate plots.

can I change the color of each plot by using those commands?
for example I want plot(A(:,1),A(:,2)) be read, plot(A(:,1),A(:,3)) be green and so on.

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook