MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
When the Editor dialog box opens, enter a condition and click OK. A condition is any valid
MATLAB expression that returns a logical scalar value. MATLAB evaluates the condition
before running the line.

For example, suppose that you only want to pause in randomdata.mlx if the random
generated data contains a 0.

Add a breakpoint with the following condition at line 3:

any(r == 0)

A yellow conditional breakpoint appears at that line.

When you run the file, MATLAB pauses at the specified line when the condition is met. For
example, in the randomdata example, MATLAB pauses before running line 3 if any of the
values in r are equal to 0.

19 Live Scripts and Functions

Free download pdf