Function that plots columns of data on a graph

1 Ansicht (letzte 30 Tage)
Bryan O'Donnell
Bryan O'Donnell am 5 Mär. 2015
Kommentiert: Star Strider am 5 Mär. 2015
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.

Akzeptierte Antwort

Star Strider
Star Strider am 5 Mär. 2015
Bearbeitet: Star Strider am 5 Mär. 2015
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
  11 Kommentare
Bryan O'Donnell
Bryan O'Donnell am 5 Mär. 2015
Thanks! This works!
Star Strider
Star Strider am 5 Mär. 2015
My pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Geographic Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by