This might be a really stupid question, but I'll go ahead anyway. I'm trying to use Julia's tic()
and toc()
inside a loop in order to figure out some timing issues. A dummy example is shown below:
elapsedTime = zeros(3);
for i = 1:3
tic();
pause(i)
ElapsedTime[i] = toc();
end
The goal is to store the elapsed time intervals in the array ElapsedTime
. The issue is that toc()
seems to a) print the elapsed time to screen and b) store it as wanted.
Is there some simple trick to avoid a), ie. that toc()
prints the result? It's not a huge problem, just annoying if the number of iterations is large.
Any help will be greatly appreciated!
there is another version of toc() called toq() which doesn't print a thing and returns the elapsed time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With