最近玩GUI玩的比較多,想分享一些好玩的東西,就從最簡單的開始吧
大家都知道matlab的進度條吧,這裏實現了創建進度條,並且當進度條達到100%時就關閉進度條界面
state = 0;
h = waitbar(0, '請等待...', 'Name', '進度條', 'CreateCancelBtn', ...
'state = 1; delete(h); clear h');
h1 = findall(h, 'style', 'pushbutton');
set(h1, 'string', '取消', 'fontsize', 10)
for i = 1 : 100
waitbar(i / 100, h, ['進度完成' num2str(i) '%']);
pause(0.1)
if state
break
end
end
if exist('h') == 1
delete(h);
end