Skip to content
Jeffrey Markowitz edited this page Sep 1, 2013 · 4 revisions

Use breakpoints to stop script execution at any line of code and access the execution state. For example, in MATLAB, you can set breakpoints using the dbtop function. Suppose one of your scripts, sortspikes.m throws an error on execution. You can systematically step through each line of the code like so

dbstop in sortspikes

Now run sortspikes again.

sortspikes(crazygoodspikes)

MATLAB will pause at the first line and enter "debug mode" where you can step through each line and check variable names.

dbstep

Will advance to the next line. You can also set breakpoints at a specific line in the code using the following syntax.

dbstop in sortspikes at 100

This will stop the execution at line 99, allowing you to check the values of your variables, etc. etc.

Clone this wiki locally