How to calculate execution time in Matlab?

2 visualizaciones (últimos 30 días)
Sihem
Sihem el 30 de Jul. de 2022
Comentada: Sihem el 30 de Jul. de 2022
#Help_Please
Hello, hope that you're in a good health
I have 2 heuristics and i want to calculate the execution time for each instance, what's the right instruction to do it?

Respuesta aceptada

Jan
Jan el 30 de Jul. de 2022
The direct method:
tic
x = sin(rand(1e4, 1e4));
toc
Elapsed time is 1.294872 seconds.
The smart method:
timeit(@() sin(rand(1e4, 1e4)))
ans = 1.2593

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by