Is there a way to specify code to be run whenever an error occurs in Matlab? Googling I came across RunTimeErrorFcn and daqcallback, but I believe these are specific to the
One trick is to use Error Breakpoints by issuing the command:
dbstop if error
which when enabled, causes MATLAB to enter debug mode at the point of error. You can access the same functionality from the Debug menu on the main toolbar.