program runtime question
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a program that (for what I've done so far) takes a long time to run (~4s per loop). In the final version of the code I will be performing hundreds of loops. Would it be quicker if I assigned parts of the code as functions, or would this actually increase the run time?
Thanks
Richard
0 个评论
采纳的回答
Walter Roberson
2011-4-6
It is difficult to predict exactly how MATLAB will optimize code. Especially before 2010b, the details how how the code was written in the file could make a substantial difference. This is one of those "You'd have to try it and see" matters.
Have you used the profiler to track down the portion of your code that is taking a lot of time?
更多回答(1 个)
Jason Ross
2011-4-6
Have you looked into using functions from the Parallel Computing Toolbox (parfor, spmd, etc)?
Of course, not knowing your problem, you may have conditions that prevent the use of these functions.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!