MATLAB: How to perform CLEAR CLASSES without removing breakpoints

MATLAB

I am working with classes that have breakpoints set inside them. Often, I need to run the CLEAR CLASSES command. This command has the unwanted side effect of clearing the breakpoints as well.

Best Answer

The ability to clear classes without clearing breakpoints is not available in MATLAB 7.8 (R2009a). As a workaround, you can create a custom function that saves the breakpoints, clears classes, and then restores the breakpoints.
function clear_classes()
current_breakpoints = dbstatus('-completenames');
evalin('base', 'clear classes');
% get around bug where red icons are not displayed
% by pausing for a short time
pause(0.1)
dbstop(current_breakpoints );
end