Effacer les filtres
Effacer les filtres

24 Hours for run my for loop

4 vues (au cours des 30 derniers jours)
Marco Migliori
Marco Migliori le 16 Août 2022
Commenté : Marco Migliori le 16 Août 2022
Hi guys, I wanted to ask if there is a toolbox or a way to speed up the run of my for loop. I have a 2017 MacBook with 8GB of RAM and my script takes 24 hours to find the results. Is there the possibility of using a machine on the server with a higher ram?

Réponse acceptée

the cyclist
the cyclist le 16 Août 2022
Without seeing your code, it is impossible to know specifically what are possible approaches to speed it up, but two possibilities are

Plus de réponses (1)

John D'Errico
John D'Errico le 16 Août 2022
The crystal ball is soooo foggy today. I just cannot look into your computer to know why your code is slow. All the darned thing will tell me is that I may come into a large sum of money soon. Or maybe, it is telling me my heirs might do the same thing. Such a foggy crystal ball.
Seriously, we cannot know why your code is slow, so it is impossible to know how to make it run faster. At the same time, your question tends to suggest you are not an expert at MATLAB. And that suggests your code might be inefficiently written.
The very first thing you need to do is to look carefully at your code, using the profiling tools in MATLAB. Look here: profile
What you will be looking to find are bottlenecks in your code. What is costing you time? What lines of code are the problems? Next, look carefully at those lines. Can they be improved? It is often the case that you are doing something inefficiently. So can you improve that line of code?
I would point out that often you can gain some speed by the use of tools like parfor. At the same time, you can often gain orders of magnitude in speed by simply writing efficient code.
  1 commentaire
Marco Migliori
Marco Migliori le 16 Août 2022
Yes, i use MATLAB on University for modelling Time-Series. My problem Isn't code but a for cycle. I have a for loop that generates 3500 iterations, in each loop I apply on a 1500x361 matrix a function generated by some researchers which in turn contains 4 for loops in which 3 other functions are called, so I have not entered the code.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Elementary Math dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by