# Using ‘dbstop if error’ and conditional breakpoints to debug MATLAB1

Posted by Doug Hull,

Sometimes MATLAB throws an error, but because the error is inside of a function you can not see what caused this error. By telling the debugger to stop execution under certain conditions or right before an error is thrown you will be better able to understand the conditions that caused the error.

I use dbstop if error all the time, for many years. In fact it’s even in my startup.m script. However, users should be aware that it has some drawbacks on the latest Matlab releases: