program runtime question

조회 수: 2 (최근 30일)
darksideofthemoon101
darksideofthemoon101 2011년 4월 6일
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

채택된 답변

Walter Roberson
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
darksideofthemoon101
darksideofthemoon101 2011년 4월 6일
No, I might try this. Thanks Walter (and everyone else on here), you guys are great!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jason Ross
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.

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by