

To continue running the code, click the Continue button. Changes that are made while MATLAB is paused do not run until after MATLAB finished running the code and the code is rerun. It is a good practice to avoid modifying a file while MATLAB is paused. For example, click theĪrea next to line three in plotRand.m to add a breakpoint at that The executable line where you want to set the breakpoint. Standard breakpoint in the Editor or Live Editor, click the gray area to the left of There are three types of breakpoints: standard, conditional, and error. You can add breakpoints interactivelyīy using the Editor and Live Editor, programmatically by using functions in the Run your code, add breakpoints at those lines. If there are lines of code in your file that you want to pause at every time you For more information, see Examine Values While Debugging. You can examine the values of variables outside of the current workspace by

Variables that you create in a function belong to their own function Variables that youĪssign through the Command Window or create by using scripts belong to the base Workspaces contain variables that you create within MATLAB or import from data files or other programs. Stack, is shown at the top of the file and displays theįunctions in order, starting on the left with the first called script orįunction, and ending on the right with the current script or function in whichįor each function in the function call stack, there is a corresponding When you step into a called function or file, MATLAB displays the list of the functions it executed before pausing at In and out of user-defined and MathWorks ® functions. Show contextual Step in buttons preference and always step Step In or Step Out buttons on the Editor or To never show the button, set the ShowĪlternatively, you can step in and out of functions while debugging by using the Show contextual Step in buttons option toĪlways. Then, select MATLAB > Editor/Debugger, and in the Debugging section, set the To show the button for all functions and scripts, on theĬlick Preferences. After stepping in, click the Step Out buttonĪt the top of the file to run the rest of theĬalled function, leave the called function, and then pause.īy default, the Step In button displays only for user-defined functions and MATLAB displays the button only if the line contains a call to anotherįunction or script. To step into a file, click the Step In buttonĭirectly to the left of the function or script While debugging, you can step into called files, pausing at points where you want Clicking the Pause button can cause MATLAB to pause in a file outside your own code.
