通过代码设置Matlab waitbar取消键,实现点击取消键终止当前正在运行的程序并关掉waitbar
h = waitbar(0,'Start beamforming,please wait...', 'CreateCancelBtn' ,'setappdata(gcbf, ''isCanceled'', true)');
hCancelButton = findall(h, 'style', 'pushbutton');
set(hCancelButton, 'string', 'Cancel', 'fontsize', 8); % 通过该行设置取消键的显示文字及格式
setappdata(h, 'isCanceled', false);
for
****************
****************
if getappdata(h, 'isCanceled')
delete(h);
return;
end
end