timeit
Measure time required to run function
Description
t = timeit( measures the time (in seconds)
required to run the function specified by the function handle f)f.
In order to perform a robust measurement, timeit calls the
specified function multiple times and returns the median of the measurements. If the
function runs fast, timeit might call the function many
times.
t = timeit( calls f,numOutputs)f with
the desired number of outputs, numOutputs. By default, timeit calls
the function f with one output (or no outputs,
if the function does not return any outputs).
Examples
Input Arguments
Tips
The following actions result in unexpected output:
- Using
timeitbetweenticandtoc - Using
timeitto time a function that includes calls toticandtoc - Using
timeitrecursively
- Using
Extended Capabilities
Version History
Introduced in R2013b