|MATLAB Function Reference|
Terminate execution of
terminates the execution of a
while loop. Statements in the loop that appear after the
break statement are not executed.
In nested loops,
break exits only from the loop in which it occurs. Control passes to the statement that follows the
end of that loop.
break is not defined outside a
while loop. Use
return in this context instead.
The example below shows a
while loop that reads the contents of the file
fft.m into a MATLAB character array. A
break statement is used to exit the
while loop when the first empty line is encountered. The resulting character array contains the M-file help for the
© 1994-2005 The MathWorks, Inc.