How to measure running time of a code using MATLAB

328 visualizaciones (últimos 30 días)
Jose Ricardo Milandro Hibaler
Jose Ricardo Milandro Hibaler el 8 de Nov. de 2011
Comentada: Sandip el 16 de Dic. de 2023
Hi. I am new in using MATLAB. I have a thesis about code optimization along with my partner. It was recommended by our adviser to use the software in order t measure the running time of the code. The code is in Java Programming Language. Now, how can I measure the running time of the code using MATLAB?
  2 comentarios
Paulo Abelha
Paulo Abelha el 17 de Sept. de 2016
Hi,
I've coded a function that might help you:
https://uk.mathworks.com/matlabcentral/fileexchange/59187-displayestimatedtimeofloop--tot-toc--curr-ix--tot-iter--
Rehan Ashraf
Rehan Ashraf el 18 de Oct. de 2017
hi; where you want to calculate the time of your code so first you placed tic and toc command in your script.e.g: start tic; code toc

Iniciar sesión para comentar.

Respuesta aceptada

Lucas García
Lucas García el 8 de Nov. de 2011
  9 comentarios
Steven Lord
Steven Lord el 19 de Nov. de 2023
Walter Roberson's comment from 29 Sep 2016 is still valid today.

Iniciar sesión para comentar.

Más respuestas (1)

Taha
Taha el 3 de Mayo de 2016
beginn your script with tic and end it with toc. At the end the Elapsed time is showed in MATLAB in seconds.
  3 comentarios
Aaya Aboelfotoh
Aaya Aboelfotoh el 11 de Jun. de 2019
Hi Taha,
Is there a way that the elapsed time can be stored as an output? Since I am recording the outputs from matlab to an excel file, i want it to also write the elapsed time as well (instead of manually reading the time and writing it down).

Iniciar sesión para comentar.

Categorías

Más información sobre Programming 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