tic

Sets an internal clock.

Syntax

R = tic()

Outputs

R
Resulting scalar.

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

Subsequent calls to toc return the elapsed time since tic was called. Returns a handle which can be used as an input to toc allowing multiple tic/toc timers to be used concurrently.