Compute execution time without printing statement?
5 次查看(过去 30 天)
显示 更早的评论
I am wondering if it is possible to compute the execution time using tic and toc statement but eliminating printing time?
I have a big program ... and it has a lot of printing statements in the middle ...
Is it possible to count the time without the time consumed by printing? or should I stop each printing statement one by one?
2 个评论
James Tursa
2019-9-4
Do you mean you have lots of disp( ) or fprintf( ) etc. statements, but want to somehow not count them in the timing results?
回答(1 个)
Fabio Freschi
2019-9-4
编辑:Fabio Freschi
2019-9-4
You can just save the value in a variable
timerValue = tic;
% something very useful to do
tstop = toc(timerValue);
4 个评论
Fabio Freschi
2019-9-4
ok, sorry...
Count the time for printf wit tic/toc like I said and subctract the value from the time of computation
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!