Borrar filtros
Borrar filtros

Strange results from tic / toc.

1 visualización (últimos 30 días)
John Doe
John Doe el 9 de Mayo de 2013
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?

Respuesta aceptada

cr
cr el 9 de Mayo de 2013
Editada: cr el 9 de Mayo de 2013
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 comentario
John Doe
John Doe el 9 de Mayo de 2013
You're of course right =) Thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by