FUNCTION REFERENCE

toc

Read elapsed time in seconds.

Read elapsed time in seconds.

Syntax

toc

Syntax

elapsed = toc

Syntax

toc(id)

Syntax

elapsed = toc(id)

Without an id, reads the timer started by tic without an output; it errors if none was started. An id comes from id=tic. With an output, returns a nonnegative double scalar. Without an output, prints 'Elapsed time is ... seconds.' Reading a timer does not reset it.

Example

tic; elapsed=toc; elapsed>=0   % true

Differences from MATLAB: Measured times vary; error wording differs.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.