How do I save the break points in my MATLAB files between MATLAB sessions?

17 views (last 30 days)
I have a long MATLAB file that I want to debug. I add breakpoints to my file, however, when I close MATLAB, all of these breakpoints are lost and I have to recreate them in my next MATLAB session.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 13 May 2016
Edited: MathWorks Support Team on 13 May 2016
Since MATLAB R2006b, you can save breakpoints and reuse them in a later session by saving the status of breakpoints to a MAT-file using
s = dbstatus
and restoring the breakpoint status at a later time by loading the MAT-file using
dbstop(s)
which is a new option, introduced in MATLAB R2006b.
See the example in the dbstatus reference page of the documentation by running
doc dbstatus
Prior to MATLAB R2006b, you can workaround this issue by inserting the following line of code where you would like to set a breakpoint:
keyboard
The keyboard function has the same functionality of a breakpoint, but it can be saved in the code.

More Answers (0)

Categories

Find more on Debugging and Analysis in Help Center and File Exchange

Products


Release

R2006a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!