Skip to content
Mikhail Panko edited this page Sep 2, 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 GUI or the dbtop() function. Suppose one of your scripts, sort_spikes() throws an error on execution. You can systematically step through each line of the code like so:

dbstop in sort_spikes

Now run sort_spikes() again:

sort_spikes(crazy_good_spikes)

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

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 sort_spikes at 100

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

Clone this wiki locally