Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

dbstep

Execute next executable line from current breakpoint

Syntax

Description

example

dbstep executes the next executable line of the current file during debugging, skipping any breakpoints set in functions called by the current line.

example

dbstep in steps to the next executable line. If that line contains a call to another MATLAB® code file function, execution steps to the first executable line of the called function. If there is no call to a MATLAB code file on that line, dbstep in is the same as dbstep.

example

dbstep out runs the rest of the current function and stops just after leaving the function. MATLAB pauses execution at any breakpoint it encounters.

example

dbstep nlines executes the specified number of executable lines. MATLAB pauses execution at any breakpoint it encounters.

Examples

collapse all

Create a file, myfile.m, that contains these statements.

function n = myfile(x)
n = myfunction(x-1);

function z = myfunction(y)
z = 2 / y ;

Set a breakpoint at the first line in myfile and run myfile with an input of 1. MATLAB pauses in the function myfile, at the line n = myfunction(x-1).

dbstop in myfile
myfile(2);
2   n = myfunction(x-1);

Step to the next execution line. MATLAB reaches the end of the function myfile.

K>> dbstep
End of function myfile.

Step once more to complete the execution of myfile and end debugging.

Create a file, myfile.m, that contains these statements.

function n = myfile(x)
n = myfunction(x-1);

function z = myfunction(y)
z = 2 / y ;

Set a breakpoint at the first line in myfile and run myfile with an input of 1. MATLAB pauses in the function myfile, at the line n = myfunction(x-1).

dbstop in myfile
myfile(2);
2   n = myfunction(x-1);

Step into myfunction. MATLAB enters myfunction and pauses at the first line in the function.

K>> dbstep in
5   z = 2 / y;

Step through the next four lines of code, completing the execution of myfile and ending debugging.

K>> dbstep 4
ans =

   2

Create a file, myfile.m, that contains these statements.

function n = myfile(x)
n = myfunction(x-1);

function z = myfunction(y)
z = 2 / y ;

Set a breakpoint at the first line in myfile and run myfile with an input of 1. MATLAB pauses in the function myfile, at the line n = myfunction(x-1).

dbstop in myfile
myfile(2);

Step into myfunction. MATLAB enters myfunction and pauses at the first line in the function.

K>> dbstep in
5   z = 2 / y;

Step out of myfunction. MATLAB finishes executing myfunction and returns to the calling function myfile.

K>> dbstep out
2   n = myfunction(x-1);

Step out one more time to complete the execution of myfile and end debugging.

Related Examples

Input Arguments

collapse all

Number of executable lines to execute, specified as a positive integer.

See Also

| | | |

Introduced before R2006a

Was this topic helpful?