toc
Calls to toc return the elapsed time since tic was called.
Syntax
R = toc(handle)
Inputs
- handle
- A value returned by a prior call to the tic function.
Example
Simple example:
tic()
sleep(5)
toc()
Elapsed time is 5.007 seconds.
Timer1 = tic
sleep(5)
Timer2 = tic
printf('time since first tic:\n')
toc(Timer1)
printf('\ntime since second tic:\n')
toc(Timer2)
Timer1 = 9793394
Timer2 = 9798396
time since first tic:
Elapsed time is 5.006 seconds.
time since second tic:
Elapsed time is 0.008 seconds.
Comments
Multiple timers can be used concurrently by providing a handle returned by tic as in input argument for toc.