FUNCTION REFERENCE
timeit
Estimate the elapsed time of a zero-input function handle.
Estimate the elapsed time of a zero-input function handle.
Syntax
seconds = timeit(f)Syntax
seconds = timeit(f, outputCount)Warms up once and returns the median of five batches. Each batch performs at most 64 calls or 25 ms of work; a single call can take longer. Output count defaults to one. Ordinary execution budgets and cancellation apply. The function may run many times, so account for side effects.
Example
class(timeit(@() ones(10))) % double (a fast-call warning may also appear)Differences from MATLAB: Uses a bounded sampling algorithm rather than MATLAB calibration; interpreter overhead is included. Explicit output counts are limited to 0 through 16.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.