MATLAB: Function that plots columns of data on a graph

columnsfunctionsplot

I have matrix called M with 50 columns and about 5000 rows of data. I'm trying to create a function plotme(M,N) where N is the number of figures to be plotted.
Such that if I have plotme(M,5) 5 figures are created, each containing 10 columns of data. The first figure should plot columns 1-10, the second plots columns 11-20, and so on.
I'd appreciate any help with this. Thanks.

Best Answer

Not the full function, but a loop that will do the plotting:
M = randi(100, 100, 50);
NrFig = 5;
NrPlot = fix(size(M,2)/NrFig);
for k1 = 1:NrFig
idxrng = [1:NrPlot]+NrPlot*(k1-1)
figure(k1)
plot(M(:,idxrng))
end