Obscure Matlab feature #0: Debug on error

If you have a long running function that you just wrote and need to debug, type this in the Matlab command window:

dbstop if error

This will cause the debugger to kick in as soon as a Matlab error is thrown, so you can trace the variables in your function which are erased from memory as soon as the function is exited. To remove this behaviour, type:

dbclear if error


Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s