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

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?

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')

clear all is a heavy hammer. For example, it also dumps all the parsed MATLAB code already in memory. A simple clear or one of the other options is usually a better choice and will not wipe your breakpoints.


I had the same issue : after running my code, all breakpoints were deleted. I finally found that you could restore your last breakpoints by clicking on "Set / clear breakpoints" (F12 keypad).


Need Your Help

Get the IP address of the machine

c++ linux networking ip-address

This Question is almost the same as the previously asked Get the IP Address of local computer-Question. However I need to find the IP address(es) of a Linux Machine.