给参考程序看看
x = 0;
h = waitbar(x,'请稍等','CreateCancelBtn','delete(gcbf)');
hBtn = findall(h, 'type', 'uicontrol');
set(hBtn, 'string', '取消', 'FontSize', 10);
try
while ishandle(h)
waitbar(x, h, ['前进度:' num2str(x*100) '%']);
x = x + 0.1;
if x > 1
break
end
pause(1);
end
delete(h);
clear h;
end