dbclear
Remove breakpoints
Description
dbclear all
removes all breakpoints in all MATLAB® code files, and all breakpoints set for errors, caught errors,
caught error identifiers, warnings, warning identifiers,
naninf
, and output that isn't suppressed by a
semicolon.
Examples
Clear Breakpoints in File
Set and then clear breakpoints in a program file.
Create a file, buggy.m
, that contains
these statements.
function z = buggy(x)
n = length(x);
z = (1:n)/x';
Add breakpoints at line 2 and line 3. List all breakpoints
using dbstatus
.
dbstop in buggy at 2 dbstop in buggy at 3 dbstatus
Breakpoints for buggy are on lines 2, 3.
Remove all the breakpoints in buggy.m
.
Call dbstatus
to confirm that all breakpoints
are cleared.
dbclear in buggy dbstatus
Clear Breakpoints in File at Location
Set and then clear breakpoints in a program file at a certain location.
Create a file, buggy.m
, that contains
these statements.
function z = buggy(x)
n = length(x);
z = (1:n)/x';
Add breakpoints at line 2 and line 3. List all breakpoints
using dbstatus
.
dbstop in buggy at 2 dbstop in buggy at 3 dbstatus
Breakpoints for buggy are on lines 2, 3.
Remove the breakpoint at line 3 and call dbstatus
.
dbclear in buggy at 3 dbstatus
Breakpoint for buggy is on line 2.
Clear Error Breakpoints
Set and clear an error breakpoint.
Create a file, buggy.m
, that requires
an input vector.
function z = buggy(x)
n = length(x);
z = (1:n)/x';
Set an error breakpoint, and call buggy
with
a matrix input instead of a vector.
dbstop if error buggy(1:10)
A run-time error occurs, and MATLAB goes into debug mode,
pausing at line 3 in buggy.m
.
Error using / Matrix dimensions must agree. Error in buggy (line 3) z = (1:n)/x'; ^
Call dbquit
to exit debug mode.
Clear the breakpoint, and call buggy
again
with a matrix input instead of a vector.
dbclear if error buggy(1:10)
A run-time error occurs, and MATLAB pauses execution immediately, without going into debug mode.
Error using / Matrix dimensions must agree. Error in buggy (line 3) z = (1:n)/x'; ^
Input Arguments
file
— File name
character vector | string scalar
File name, specified as a character vector or string scalar. The file name can include a partial path name for files on the MATLAB search path or an absolute path name for any file. For more information on valid file names in MATLAB, see Specify File Names.
Example: myfile.m
In addition, file
can include a filemarker
(>
) to specify the path to a particular local
function or to a nested function within the file.
Example: myfile>myfunction
Data Types: char
| string
location
— Location in file
line number | line number and anonymous function number | local function name
Location in file
of breakpoint to clear,
specified as follows:
Line number in
file
specified as a character vector or string scalar. The default is1
.Line number in
file
, at the anonymous function number, specified as a character vector or string scalar. For example,1@2
specifies the second anonymous function on line number 1. If no anonymous function number is specified, then the default is1
.Name of a local function in
file
specified as a character vector or string scalar.
Data Types: char
| string
condition
— Type of error breakpoint
error
| caught error
| warning
| naninf
| ...
Type of error breakpoint, specified as follows:
error
— Run-time error that occurs outside atry/catch
block. If you want to clear a breakpoint set for a specific error, then specify the message id. For example:dbclear if error
clears all breakpoints set with thedbstop if error
command, including breakpoints with a specified message id.dbclear if error MATLAB:ls:InputsMustBeStrings
clears the error with a message ID ofMATLAB:ls:InputsMustBeStrings
.
caught error
— Run-time error that occurs within thetry
portion of atry/catch
block. If you want to clear a breakpoint set for a specific error, then specify the message id.warning
— Run-time warning. If you want to clear a breakpoint set for a specific warning, then specify the message id.This condition has no effect when you disable warnings with the
warning off all
command or when you disable warnings for the specified message id. For more information about disabling warnings, seewarning
.naninf
— Not-a-number error or infinite value error. These errors occur when code returns an infinite value (Inf
) or a value that is not a number (NaN
) as a result of an operator, function call, or scalar assignment.In R2024b:
unsuppressed output
— The code displays an unsuppressed output because the line is not suppressed by a semicolon (;
). Outputs that are displayed as the result of a function call, such as fromdisp
orfprintf
will not stop execution.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)