Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restore breakpoints in MATLAB after "clear all"?

Tags:

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?

like image 715
Shashank Sawant Avatar asked Sep 29 '12 22:09

Shashank Sawant


People also ask

How do you clear all breakpoints in MATLAB?

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.

How do you set breakpoints in MATLAB?

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.

How do you step through a code in MATLAB?

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.

How do you stop a code execution in MATLAB?

To stop execution of a MATLAB® command, press Ctrl+C or Ctrl+Break.


1 Answers

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') 
like image 105
Jonas Avatar answered Sep 22 '22 07:09

Jonas