MATLAB Answers

How to check in which step MATALB code is running?

조회 수: 156(최근 30일)
Ketan
Ketan 25 Aug 2014
답변: Ben11 25 Aug 2014
I have made a code which took approx 4-5 hours to execute.....So how could I know on which step that code is running and how much time will it take to complete ?

  댓글 수: 0

로그인 to comment.

답변(2개)

Star Strider
Star Strider 25 Aug 2014
Without seeing the code it’s impossible to say exactly. However when I run long simulations (usually with at least one loop), I start a time counter with the clock function at the beginning of the program (before the start of the loop), and just prior to the ends of the main loop, I put an fprintf statement that reports what the loop counter is, uses the etime function to show how long that loop took, and another calculation of how long the entire program has been running. All that prints in the Command Window. One fprintf statement like that doesn’t slow the code down noticeably, but it can be reassuring.

  댓글 수: 0

로그인 to comment.


Ben11
Ben11 25 Aug 2014
You might also want to look into dbstack, which tells you the actual line of code being executed.

  댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by