MATLAB测量函数运行时间 [英] MATLAB measure a function run time
本文介绍了MATLAB测量函数运行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在MATLAB中打印函数的时间
How to print the time of a function in MATLAB
示例:
%%%TAKE TIME
A = [2 1 3 ; 1 2 5 ;3 5 4 ]
[U,S,V] = svd(A)
%%%FINISH TIME
语法是什么?
推荐答案
,您还可以使用 tic和toc :
tStart=tic;
A = [2 1 3 ; 1 2 5 ;3 5 4 ]
[U,S,V] = svd(A)
tElapsed=toc(tStart);
这允许使用多个计时器. (否则,必须确保将tic
和toc
专用于一次测量)
This allows the use of more than one timer. (otherwise you have to ensure exclusive use of tic
and toc
for one measurement)
这篇关于MATLAB测量函数运行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文