MATLAB: Need popup for end user instead of ding for code failure

application compilercode failuredingpopup

I am using the Application Compiler App in Matlab for a end user to use a GUI from GUIDE. Sometimes the code failes for whatever reason and a loud ding is issued. Instead of a ding how would I have a Popup like …h = msg('The code has failed please rerun') or similar to pop up to allow the user to know there code failed encase they had the volume on mute and did not hear the ding. Thank you

Best Answer

Use a try/catch block around any questionable code.
If the error might be in something you cannot effectively control, such as if a Callback property had been set to something invalid and an error is generated when the callback is triggered, then there is not really anything you can do. You can use "dbstop if error" to cause the debugger to be triggered, but you would not be able to run your own code in such a case.