plotting with for loops taking more than 2hours

6 visualizzazioni (ultimi 30 giorni)
Attached code is taking more than two hour to run and produce the plots. Requesting to kindly suggest a solution to improve the speed and efficiency. Thanks in advance.
  5 Commenti
Lakshmi Chodavarapu
Lakshmi Chodavarapu il 2 Mar 2024
Modificato: Lakshmi Chodavarapu il 2 Mar 2024
I need the linal set of 12 plots with cumulative data presented as plots.
There are two arrays of PRNS. PRN-A with length 28 and PRNB with length 28 or may be less.
My code is to do:
Take each PRN from the array PRN-A, and where ever PRNA exists in the whole 24 hours duration ( in the datarows nearly 50K) and with the first PRN in the array of PRN-B, plots data in 12 figures. So here the loop one index is 1, and loop 2 index is 1 to 28.
If for a PRN from array A , any PRN from array B is not pairing, no data will be there and so no plot. So for each PRN from array, A, the code checks all 50K rows and where ever A is there it plots 12 figures.
Like this, loop1 will have 28 iterations with each having 28 internal iterations to check the intersection, so nearly 784 iterations. The aim is to plot 24 hours data for all possible pairs of PRNS.
I need only the final cumulative data plots- a set 12, please
Lakshmi Chodavarapu
Lakshmi Chodavarapu il 2 Mar 2024
Thanks to you both DGM and Cris LaPierre. Following your suggestions, I shifted all save commands to out of both the for loops and now the task took exactly 10min. Grateful to both of you.
If any more efficient solution is there, will be still grateful to take.

Accedi per commentare.

Risposte (0)

Categorie

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

Community Treasure Hunt

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

Start Hunting!

Translated by