24 Hours for run my for loop

2 ビュー (過去 30 日間)
Marco Migliori
Marco Migliori 2022 年 8 月 16 日
コメント済み: Marco Migliori 2022 年 8 月 16 日
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?

採用された回答

the cyclist
the cyclist 2022 年 8 月 16 日
Without seeing your code, it is impossible to know specifically what are possible approaches to speed it up, but two possibilities are

その他の回答 (1 件)

John D'Errico
John D'Errico 2022 年 8 月 16 日
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 件のコメント
Marco Migliori
Marco Migliori 2022 年 8 月 16 日
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.

サインインしてコメントする。

カテゴリ

Find more on Application Deployment in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by