How do I execute "clear all" without affecting the breakpoints in MATLAB 8.1 (R2013a)?
조회 수: 3 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2013년 10월 25일
편집: MathWorks Support Team
2021년 2월 24일
When coding interactively, all the breakpoints are cleared when I execute "clear all".
For example, executing the following in MATLAB clears the breakpoints.
clear all
Is there a way to clear everything except the breakpoints?
채택된 답변
MathWorks Support Team
2021년 2월 24일
편집: MathWorks Support Team
2021년 2월 24일
MATLAB 8.1 (R2013a) currently does not have the ability to retain breakpoints while clearing all the variables in the workspace after issuing "clear all."
As a workaround, the following example function, clearNoBP, clears all the workspace data without removing the break points.
The functions DBSTATUS and DBSTOP are used to get this functionality.
function clearNoBP(varargin)
% returns all breakpoints into 's'
s = dbstatus;
% records all input arguements (varargin) into 'options'
options = '';
for i = 1:numel(varargin)
options = [options,',''',varargin{i},''''];
end
% Execute built-in clear function with input options in specified caller workspace
evalin('caller',['builtin(''clear''',options,')']);
% resets the breakpoints
dbstop(s);
end
The above function records all the current breakpoints, evaluates the built-in CLEAR function only in the caller’s workspace and re-sets all the breakpoints.
In order to use clear allowing the breakpoints to remain, execute the following command in the command window,
clearNoBP all
Also, refer to the following documentation link to see all the available input options with the CLEAR function.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Debugging and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!