| MATLAB Function Reference | Search  Help Desk |
| tic, toc | Examples See Also |
tic
any statements
toc
t = toc
tic
starts a stopwatch timer.
toc
prints the elapsed time since tic was used.
t = toc
returns the elapsed time in t.
This example measures how the time required to solve a linear system varies with the order of a matrix.
for n = 1:100
A = rand(n,n);
b = rand(n,1);
tic
x = A\b;
t(n) = toc;
end
plot(t)
clock Current time as a date vector
cputime Elapsed CPU time
etime Elapsed time