MATLAB: How to get different colors in plotlines of a figure when using for loop

for loopmultiple plots

I have the code below:
for i=1:num_cat
plot(Flow1(1:5),RTLbrick1_avg(i,:),'--go');
hold on
end
hold off
for every i, I have a different line but with the same color (green). How can I write the code so that for every line I will have different color lines??

Best Answer

Flow1 = rand(1,5) ;
RTL = rand(5,5) ;
num_cat = 5 ;
for i=1:num_cat
plot(Flow1(1:5),RTL(i,:));
hold on
end
hold off
legend({'i=1' ; 'i =2' ; 'i =3' ; 'i =4' ; 'i = 5'});
I have already answered this in your last question.
Or user can define his colors:
Flow1 = rand(1,5) ;
RTL = rand(5,5) ;
num_cat = 5 ;
color = {'r' 'g' 'b' 'y' 'm'} ;
for i=1:num_cat
plot(Flow1(1:5),RTL(i,:),color{i});
hold on
end
hold off
legend({'i=1' ; 'i =2' ; 'i =3' ; 'i =4' ; 'i = 5'});