MATLAB: How to make a single plot with different colors

matlab gui

x=1:10;
y=1:10;
plot(x,y)
How to make one color from 1 to 5 ,,,and 6 to 10 another plot?

Best Answer

Hi
x=1:10;
y=1:10;
plot(x(1:5),y(1:5),'r')
hold on
plot(x(5:10),y(5:10),'g')