Debugging mode of MATLAB: dbstop if error

Because I wanted to debug MATLAB program in Terminal, I stumbled into DBStop if Error by mistake. This is a brief encounter, right?Who benefits from whom?I have to tell you more about it.
MATLAB programming has some common errors, such as dimension mismatch problems. If the error is inside the function, we usually need to run the program at least twice to solve the problem by debugging: the first time we run the program, after the program reports an error, we cannot debug because we have already quit the function in error; Before running the second time, manually set the breakpoint inside the failed function and run the program a second time for debugging.
In this case, a more efficient debugging method for MATLAB is to use dbStop if Error, rather than running the program multiple times and manually setting breakpoints. When MATLAB travel, MATLAB encountered errors will stop in the error of the line of code, directly can be debugged, do not need to run again.
There are also infrequent errors in MATLAB programming, where you don’t know where to set a breakpoint before the first run. In this case, dbStop if Error can be used as a precautionary measure.
Dbstop if Error can be set on the command line and in programs, as well as in the GUI. See the video below and the related web page.

Read More: