MATLAB Function Reference |
Graphical Interface
As an alternative to the dbstack
function, you can view the Stack field in the Editor/Debugger toolbar.
Syntax
Description
dbstack
displays the line numbers and M-file names of the function calls that led to the current breakpoint, listed in the order in which they were executed. The line number of the most recently executed function call (at which the current breakpoint occurred) is listed first, followed by its calling function, which is followed by its calling function, and so on, until the topmost M-file function is reached. Each line number is a hyperlink you can click to go directly to that line in the Editor/Debugger. The notation functionname>subfunctionname
is used to describe the subfunction location.
dbstack(n)
omits from the display the first n
frames. This is useful when issuing a dbstack
from within, say, an error handler.
dbstack('
-completenames
')
outputs the "complete name" (the absolute file name and the entire sequence of functions that nests the function in the stack frame) of each function in the stack.
Either none, one, or both n
and '
-completenames
'
can appear. If both appear, the order is irrelevant.
[ST,I] = dbstack
returns the stack trace information in an m
-by-1
structure ST
with the fields
file |
The file in which the function appears. This field will be the empty string if there is no file. |
name |
Function name within the file. |
line |
Function line number. |
The current workspace index is returned in I
.
If you step past the end of an M-file, then dbstack
returns a negative line number value to identify that special case. For example, if the last line to be executed is line 15
, then the dbstack
line number is 15
before you execute that line and -15
afterwards.
Examples
dbstack In /usr/local/matlab/toolbox/matlab/cond.m at line 13 In test1.m at line 2 In test.m at line 3
See Also
dbclear
, dbcont
, dbdown
, dbquit
, dbstatus
, dbstep
, dbstop
, dbtype
, dbup
, mfilename
dbquit | dbstatus |
© 1994-2005 The MathWorks, Inc.