How can i make my MATLAB code to run faster or robust while having many function calls and for loop up to thousands?

5 次查看(过去 30 天)
I am doing my simulations in Matlab and my loop goes up to 5000 and there are many function calls due to which my simulations get more time I want to make my simulations robust and fast because I have to these simulations up to 10,000.
  1 个评论
Jan
Jan 2018-1-24
What kind of answer do you expect? The readers cannot suggest to enable a magic RunFaster flag and robustness is controlled completely by the programmer. Of course the readers can post suggestions to write efficient and reliable code, but there are hundreds of very important and useful hints. We cannot teach you software engineering in the forum.
The values 5000 and 10'000 are meaningless as long as you do not explain, what you are doing and what you want to improve. If runtime is the problem, use the profiler to find the bottlenecks of your code. Then post the relevant part of the code and some example inputs. With this, there is a chance that the forum can help you to improve the code.

请先登录,再进行评论。

回答(1 个)

Jim Riggs
Jim Riggs 2018-1-24
There is one blanket method which will speed up any Matlab code - use the Matlab compiler to generate an executable (.exe) file.

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by