MATLAB Function Reference Previous page   Next Page
tic, toc

Measure performance using stopwatch timer

Syntax

Description

tic starts a stopwatch timer.

toc prints the elapsed time since tic was used.

t = toc returns the elapsed time in t.

Remarks

The tic and toc functions work together to measure elapsed time. tic saves the current time that toc uses later to measure the elapsed time. The sequence of commands

measures the amount of time MATLAB takes to complete one or more operations, and displays the time in seconds.

Examples

This example measures how the time required to solve a linear system varies with the order of a matrix.

See Also

clock, cputime, etime, profile


Previous page  textwrap timer Next page

© 1994-2005 The MathWorks, Inc.