MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

To display the output of the rand function at line 2, remove the semi-colon at the end of
the line. To display line numbers in the Live Editor if they are not visible, go to the View


tab and press the Line Numbers button. MATLAB displays the value of r.


Debug Using Run to Here


Showing output is useful if you want to display the state of a single variable. To explore
the state of all variables in the workspace, run your live script and then pause before
running the specified line of code.


To run to a specified line of code and then pause, click the run to here button to the
left of the line. If the selected line cannot be reached, MATLAB continues running until
the end of the file is reached or a breakpoint is encountered. The run to here button is not
available in live functions.


For example, click the button to the left of line 2 in randomdata.mlx. MATLAB runs
randomdata.mlx starting at line 1 and pauses before running line 2.


Debug Code in the Live Editor
Free download pdf