matlb中计算时间的一些命令

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-28 11:20   633   0

1.用 profile函数 测试MATLAB中运行时间

例子:
profile on
plot(magic(35))
profile viewer
profsave(profile('info'),'profile_results')
profile on -history
plot(magic(4));
p = profile('info');
for n = 1:size(p.FunctionHistory,2)
if p.FunctionHistory(1,n)==0
str = 'entering function: ';
else
str = ' exiting function: ';
end
disp([str p.FunctionTable(p.FunctionHistory(2,n)).FunctionName]);
end
2. tic,toc
tic

operation

toc

3. cputime
t=cputime;

your_operation

cputime-t

4. clock,etime
t0 = clock;
operation
etime(clock,t0)

本文来自: 高校自动化网(Www.zdh1909.com) 详细出处参考(转载请保留本链接):http://www.zdh1909.com/html/matlab/9501.html

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP