How to measure running time of a code using MATLAB

334 ビュー (過去 30 日間)
Jose Ricardo Milandro Hibaler
Jose Ricardo Milandro Hibaler 2011 年 11 月 8 日
コメント済み: Sandip 2023 年 12 月 16 日
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 件のコメント
Paulo Abelha
Paulo Abelha 2016 年 9 月 17 日
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 2017 年 10 月 18 日
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

サインインしてコメントする。

採用された回答

Lucas García
Lucas García 2011 年 11 月 8 日
  9 件のコメント
Steven Lord
Steven Lord 2023 年 11 月 19 日
Walter Roberson's comment from 29 Sep 2016 is still valid today.
Sandip
Sandip 2023 年 12 月 16 日

サインインしてコメントする。

その他の回答 (1 件)

Taha
Taha 2016 年 5 月 3 日
beginn your script with tic and end it with toc. At the end the Elapsed time is showed in MATLAB in seconds.
  3 件のコメント
Aaya Aboelfotoh
Aaya Aboelfotoh 2019 年 6 月 11 日
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).
Walter Roberson
Walter Roberson 2019 年 6 月 11 日
your_variable = toc;

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by