当运行大程序,需要跑大量数据的时候,使用进度条可以看到程序究竟运行到什么地方了,哈哈,要不干等着难受(╯﹏╰)……
先介绍简单用法:
h=waitbar(x,’message’);%其中x必须为0到1之间的数,message为显示的信息
h=waitbar(0,'please wait');
for i=1:1000
%computation here%
waitbar(i/1000,h)
end
delete(h);
如果要用数字显示运行进度,
h=waitbar(0,'please wait');
for i=1:1000
%computation here%
str=['运行中...',num2str(i/1000*100),'%'];
waitbar(i/1000,h,str)
end
delete(h);