One thing you could do is just change the ColorOrder property of the axes itself:
f = figure;
colors = [0 0 0.7; 0.7 0 0; 0 0 0; 0 0.7 0 0]; % b,r,k,g
a = axes('ColorOrder',colors)
% plot your lines and they will be plotted with these colors in order.
plot(x,y);
hold on
plot(x2,y,2);
Then plot your other lines ...
Your other option is to change with a single plot the way you showed:
plot(x,y,'Color',[0 0.7 0]);
which could be accomplished in your loop:
if m == 1
color = 'b';
elseif m == 2
color = 'r';
elseif m == 3
color == 'k'
elseif m == 4
color == [0 0.7 0];
end
plot(x,y,'Color',color);
Avoid using nested if statements as they are not needed. The elseif is a single keyword.