I have a habit of beginning all my MATLAB scripts with clear all; close all; clc
. While it has been a very useful line, as soon as it executes, it wipes out all my breakpoints. Is there a simple way to avoid that?
dbclear in file removes all breakpoints in the specified file. The in keyword is optional. dbclear in file at location removes the breakpoint set at the specified location in the specified file. The at and in keywords are optional.
A standard breakpoint pauses at a specific line in a file. To set a standard breakpoint, click the gray area to the left of the executable line where you want to set the breakpoint. Alternatively, you can press the F12 key to set a breakpoint at the current line.
MATLAB continues running the file until it reaches the end of the file or a breakpoint. You also can click the Continue to Here button to the left of the line of code that you want to continue running to. To continue running the code line-by-line, on the Editor or Live Editor tab, click Step.
To stop execution of a MATLAB® command, press Ctrl+C or Ctrl+Break.
I have solved this issue by creating a script that saves and reloads breakpoints. For convenience, you can even put it into a shortcut.
%# store breakpoints tmp = dbstatus; save('tmp.mat','tmp') %# clear all close all clear classes %# clears even more than clear all clc %# reload breakpoints load('tmp.mat') dbstop(tmp) %# clean up clear tmp delete('tmp.mat')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With