1

I want to know how to close the "waitbar" equivalent of the AppDesigner called "uiprogressdlg" when an error happend inside any callback-functions.

I dont want to implement any try-catch-elements.

I tried to use the "KeyPressFcn", "WindowKeyPressFcn", "SizeChangedFcn". But they only work, when there is no uiprogressdlg-box running.

I can't get the uiprogressdlg-handle with evalin('base','app'). In my case i use "app.PB = uiprogressdlg(app.GUIname,....) and "PB" is a public property of "app".

UseCase: While using and debugging the app, i dont want to do a complete app-restart, when this happens, but right now, thats the only solution to close the uiprogressdlg-box.

iijoexx
  • 11
  • 1

1 Answers1

1

you can use a cleanup object

    p = uiprogressdlg(figH,'Message','Plotting...','Indeterminate','on','Cancelable','on','CancelText','Close')
cleanupObjPB = onCleanup(@() close(p));

the onCleanup function will be executed when the variable a is deleted. so exiting debugger will reset the progress bar