フィルターのクリア

Execution Time

133 ビュー (過去 30 日間)
sanjay Mohanty
sanjay Mohanty 2011 年 2 月 18 日
コメント済み: Walter Roberson 2021 年 4 月 21 日
how to find the execution time of a matlab program.
  3 件のコメント
Ijaz Ahmad
Ijaz Ahmad 2021 年 4 月 21 日
The best to do is to use the "Run and Time" in the "Editor" menu. It shows a complete summary of every function that has been called and the time it has taken.
Walter Roberson
Walter Roberson 2021 年 4 月 21 日
Run and Time changes the execution time, sometimes a fair amount.

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

採用された回答

Namrata
Namrata 2011 年 2 月 18 日
execution time can be found by tic-toc command.place tic; before the first line of code and toc; after the last line of the code
e.g.
tic;
MATLAB code
toc;
  5 件のコメント
Dario gms
Dario gms 2020 年 11 月 16 日
The first time I read this i though it was a bad joke, nvm thank you
Bin Qi
Bin Qi 2021 年 2 月 3 日
It is a legit answer. Thank you.

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

その他の回答 (4 件)

Iain
Iain 2013 年 6 月 14 日
Its more powerful to use "now" to get the current time than tic & toc, but it takes a bit more effort.
  2 件のコメント
Alexander Andreychenko
Alexander Andreychenko 2016 年 4 月 5 日
Are you aware of anything that allows folding of tic/toc ? I found that there are undocumented options for tic and toc but what I exactly want is the following:
tic
% doing something large
tic
function_1();
functionTime_1 = toc;
tic
function_2();
functionTime_2 = toc;
wholeTime = toc;
Currently, in this case I see functionTime_1 and functionTime_2 but I don't see the way to get wholeTime.
Walter Roberson
Walter Roberson 2016 年 4 月 5 日
now1 = tic();
function_1();
functionTime_1 = toc(now1);
now2 = tic();
function_2();
functionTime_2 = toc(now2);
wholeTime = toc(now1);

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


Mohd Sapiee
Mohd Sapiee 2018 年 12 月 4 日
Also it is very useful to know the time taken or elapsed in Matlab is reading data from an Excel file, especially for very large number of Excel cells.
tic;
xlsread( );
toc;

Oleg Komarov
Oleg Komarov 2011 年 2 月 18 日
Also, you can use the profiler
Oleg
  1 件のコメント
Anuj Patil
Anuj Patil 2018 年 6 月 6 日
Profiler will give compile+execution time,so not useful in most applications. timeit seems a good option.
Also you can manually use 'clock' function.

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


Royi Avital
Royi Avital 2011 年 2 月 18 日
I really like using TimeIt.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by