While loop & time consumption
조회 수: 9 (최근 30일)
이전 댓글 표시
Hi!
I am using a while loop and I am actually not sure why it takes very long time for matlab to proceed the code without generating an answer. It might be that I have missed something in the code that I'm not sure about.
So my question is: Does the code contain errors that I am not aware of? and if not, what can be done so that it will go faster to proceed the whole process!
would really appreciate some feedback and help.
댓글 수: 2
Robert Cumming
2014년 2월 4일
help profile
use this to profile the code, it will show you which lines are taking the most time.
Amit
2014년 2월 4일
The first question is what does the function speed do. Because speed's output is v which controls the while loop
채택된 답변
Shivaputra Narke
2014년 2월 4일
I guess you have defined some functions like acceleration,speed. May be these functions take too much of time.
Best way to analyse your code is debugging.Use break points and go step wise to find where you code is consuming too much of time.
If you want to save time then avoid using loops. Instead try to learn and use vectorization.
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!