Compute execution time without printing statement?

1 visualización (últimos 30 días)
Seereen
Seereen el 4 de Sept. de 2019
Comentada: Rik el 4 de Sept. de 2019
I am wondering if it is possible to compute the execution time using tic and toc statement but eliminating printing time?
I have a big program ... and it has a lot of printing statements in the middle ...
Is it possible to count the time without the time consumed by printing? or should I stop each printing statement one by one?
  2 comentarios
James Tursa
James Tursa el 4 de Sept. de 2019
Do you mean you have lots of disp( ) or fprintf( ) etc. statements, but want to somehow not count them in the timing results?
Seereen
Seereen el 4 de Sept. de 2019
Yes I have fprintf and I do no want to count it in the excusion time ! ... is that possible?

Iniciar sesión para comentar.

Respuestas (1)

Fabio Freschi
Fabio Freschi el 4 de Sept. de 2019
Editada: Fabio Freschi el 4 de Sept. de 2019
You can just save the value in a variable
timerValue = tic;
% something very useful to do
tstop = toc(timerValue);
  4 comentarios
Fabio Freschi
Fabio Freschi el 4 de Sept. de 2019
ok, sorry...
Count the time for printf wit tic/toc like I said and subctract the value from the time of computation
Rik
Rik el 4 de Sept. de 2019
You could also try to shadow the fprintf function, but that is a dangerous business.

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by