Documentation

This is machine translation

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

dbdown

Reverse dbup workspace shift

Syntax

Description

example

dbdown changes the current workspace context to the workspace of the called MATLAB® code file in debug mode. You must issue the dbup command at least once before you issue this command. dbdown is the opposite of dbup.

Multiple dbdown commands change the workspace context to each successively executed MATLAB code file on the stack until the current workspace context is the line at which MATLAB is paused. You do not have to move back to the paused line to continue execution or to step to the next line.

    Note:   Changing the workspace context provides access to variables in the calling function, but does not provide access to any other functionality. MATLAB evaluates all expressions using the functions and properties available at the line at which MATLAB is paused.

Examples

collapse all

View Current and Calling Function Workspaces

Use the dbup and dbdown commands to view the current and calling function workspace of a function.

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 myfunction and run myfile with an input of 1. MATLAB pauses in the function myfunction, at the line z = 2 / y. Call whos to view the variables in the current workspace.

dbstop in myfile>myfunction
myfile(1);
whos
Name      Size            Bytes  Class     Attributes

  y         1x1                 8  double    

The workspace contains the variable y, which is in the workspace context for myfunction.

Run the dbup command to switch to the workspace of the calling function, myfile. Call whos to view the variables in the new workspace.

dbup
whos
In workspace belonging to myfile (line 2)

  Name      Size            Bytes  Class     Attributes

  x         1x1                 8  double    

The workspace contains the variable x, which is in the workspace context for myfile.

Run the dbdown command, and then call whos.

dbdown
whos
In workspace belonging to myfile>myfunction (line 5)

  Name      Size            Bytes  Class     Attributes

  y         1x1                 8  double     

The workspace once again contains the variable y, which is in the workspace context for myfunction.

Related Examples

See Also

| |

Introduced before R2006a

Was this topic helpful?