Stuart’s MATLAB Videos

Watch and Learn

Using ‘dbstop if error’ and conditional breakpoints to debug MATLAB 1

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.

1 CommentsOldest to Newest

Yair Altman replied on : 1 of 1

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:

1. It clashes with GUIDE, making GUIDE unusable (verified bug reference 1-MH5KVI)
2. It apparently causes memory leaks in the new desktop Editor, causing increasingly large delays whenever a breakpoint is encountered and exited (unverified, but also reported by others in forums)

Hopefully these bugs will be solved soon, since this is such an important debugging mechanism.

Add A Comment

Your email address will not be published. Required fields are marked *

What is 3 + 6 ?

Preview: hide