|MATLAB Function Reference|
Display function call stack
As an alternative to the
dbstack function, you can view the Stack field in the Editor/Debugger toolbar.
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.
') 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
' can appear. If both appear, the order is irrelevant.
[ST,I] = dbstack
returns the stack trace information in an
ST with the fields
||The file in which the function appears. This field will be the empty string if there is no file.
||Function name within the file.
||Function line number.
The current workspace index is returned in
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
© 1994-2005 The MathWorks, Inc.