Execution Time
109 次查看(过去 30 天)
显示 更早的评论
how to find the execution time of a matlab program.
3 个评论
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.
采纳的回答
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 个评论
更多回答(4 个)
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
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
2016-4-5
now1 = tic();
function_1();
functionTime_1 = toc(now1);
now2 = tic();
function_2();
functionTime_2 = toc(now2);
wholeTime = toc(now1);
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;
0 个评论
Oleg Komarov
2011-2-18
Oleg
1 个评论
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!