[matlab] 给循环添加进度条

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);

猜你喜欢

转载自blog.csdn.net/BAR_WORKSHOP/article/details/108102909