feisky

云计算、虚拟化与Linux技术笔记
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

matlab求程序运行时间

Posted on 2009-10-23 11:43  feisky  阅读(795)  评论(0编辑  收藏  举报
1. profile 
例子: 
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)
无觅相关文章插件,快速提升流量