Strange results from tic / toc.

조회 수: 1 (최근 30일)
John Doe
John Doe 2013년 5월 9일
I'm checking the running time of a function using tic/toc. I write the following in the command window (and execute it simultaneously):
tic
res = checkFunc('case2736sp',1:3000);
toc
Elapsed time is 0.080491 seconds.
where checkFunc returns a 2736x2500 full matrix.
What puzzles me is that I have to wait almost 20 seconds for the output saying the run time is only 80 ms.
Does anyone have a clue why this is?

채택된 답변

cr
cr 2013년 5월 9일
편집: cr 2013년 5월 9일
Are you sure 'checkFunc' does NOT do a tic somewhere in its code? Anyways, this would be a better way to test:
tx = tic; res = checkFunc('case2736sp',1:3000); toc(tx)
  댓글 수: 1
John Doe
John Doe 2013년 5월 9일
You're of course right =) Thanks!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by