I have matrices x1, x2, ...
containing variable number of row vectors.
I do successive plots
figure
hold all % or hold on
plot(x1\'
Define a function that intercepts the call to plot
and sets 'ColorOrderIndex'
to 1
before doing the actual plot.
function plot(varargin)
if strcmp(class(varargin{1}), 'matlab.graphics.axis.Axes')
h = varargin{1}; %// axes are specified
else
h = gca; %// axes are not specified: use current axes
end
set(h, 'ColorOrderIndex', 1) %// reset color index
builtin('plot', (varargin{:})) %// call builtin plot function
I have tested this in Matlab R2014b.