Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Industries Academia Support User Community Company

 

Product Support

Quick Reference Guide for Debugging Commands



This guide is a short summary describing the commands presented in the Debugging from the MATLAB Command Prompt sections of Technical Note 1207, "Techniques for Debugging MATLAB M-Files"

Setting, Clearing, and Querying breakpoints

CLEAR   Clears breakpoints and variables in current workspace
DBCLEAR   Clears breakpoints; commonly used with ALL argument to clear all
  breakpoints in all files
DBCONT   Exits debug mode; do not end execution of program
DBQUIT   Exits debug mode and execution of program
DBSTATUS   Lists currently set breakpoints
DBSTOP   Allows you to programmatically set breakpoints and stop when certain
  exception conditions are met
KEYBOARD   Forces MATLAB to stop executing the program and enter debug mode;
  you can think of this as a breakpoint which cannot be cleared
RETURN   Exits debug mode; do not end execution of program

Moving from Workspace to Workspace

  
DBDOWN   Moves down one level on the workspace stack
DBSTACK   Displays the workspace stack
DBUP   Moves up one level on the workspace stack

Executing your code step by DBSTEP

  
DBSTEP   Execute one or more lines of code, then return to debug mode prompt

DISPlaying status messages periodically

  
DISP   Displays messages you specify; useful for determining if a section of code
  executes and if it performs correctly

TRY your code and CATCH any errors

 
TRY
CATCH
END
  Executes a section of code between TRY and CATCH and if any errors
  occur, captures the error and executes the code between CATCH and END
  instead of exiting the program

Viewing and RETHROWing the LASTERROR

LASTERR
LASTERROR
  Returns the last error message and error identifier (if it exists)
LASTWARN   Returns the last warning message and warning identifier (if it exists)
RETHROW   Reissues error captured in a TRY/CATCH block using LASTERROR;

WHICH function are you?

 
WHICH   Determines if something is a variable or function and where it is located
Contact support
E-mail this page
Print this page