How do I update several graphs in one loop?

2 visualizzazioni (ultimi 30 giorni)
Matthew Koebbe
Matthew Koebbe il 28 Giu 2022
Commentato: dpb il 28 Giu 2022
I'm analyzing the results of a Monte Carlo run. I have 1,000 files of seven variables, each recorded at 2,001 timesteps. The data is stored as double floats. I want to generate six plots (the seventh variable is time) with overlays of each variable vs. time. At the end, I want six plots with 1,000 curves each.
I have a loop that cycles through the 1,000 files and extracts information from each. I'd like to build these graphs in the same loop. But I can only get a plot of the data read from the current file. How do I get six different plots to be "sticky"?
  4 Commenti
Matthew Koebbe
Matthew Koebbe il 28 Giu 2022
Since I'm processing and plotting this data in different ways, I'll try building the 3D array first. This is my first MATLAB script,so I built it in a piecewise, ad hoc manner. I'm sure it can be more efficient! Thanks for the tip. I do like writing efficient code.
dpb
dpb il 28 Giu 2022
NB: when you get to plotting that plot() is vectorized to treat columns as separate variables -- and the x variable can be a vector while the y-values are a 2D array. Just the X vector length must match the number of rows in Y.
That's where you'll get the speedup -- there was a Q? just last week where an individual was plotting some 60K points in a loop and it was taking some 10 minutes or more...<60k-lines-on-one-plot-too-slow?> I'd suggest reading it for some other ideas -- even "only" 1000 lines on a single plot probably isn't the best idea.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by