Where to find the total execution time in matlab

조회 수: 2 (최근 30일)
Aditya Shau
Aditya Shau 2018년 5월 14일
댓글: Walter Roberson 2018년 5월 14일
Suppose i am executing a code , then how do i know how much time it takes exactly to execute..Kindly suggext

답변 (1개)

Stephan
Stephan 2018년 5월 14일
편집: Stephan 2018년 5월 14일
Hi,
the toc toc command measures the elapsed time between these both commands. Its your turn where to set them.
tic
...
lots of code
...
toc
You can create a variable containing the elapsed time:
t = toc;
For example:
tic
k = 0;
for k = 1:250000
k = k+1;
end
t = toc
gives:
t =
0.0016
Best regards
Stephan
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 5월 14일
You should also investigate timeit()
Note that tic/toc and timeit() are measures of how much time it takes a specific run with that particular data. tic/toc and timeout() are not suitable for determining the "big O" theoretical measure of how long the program would take with input of a particular length.

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

Community Treasure Hunt

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

Start Hunting!

Translated by