MATLAB Functions | Help Desk |
while
Repeat statements an indefinite number of times
while expression statements end
while
repeats statements
an indefinite number of times. The statements
are executed while the real part of expression has all nonzero elements.where rop is ==, <, >, <=, >=, or ~=. The scope of aexpression
rop
expression
while
statement is always terminated with a matching end
.
The variable eps
is a tolerance used to determine such things as near singularity and rank. Its initial value is the machine epsilon, the distance from 1.0
to the next largest floating-point number on your machine. Its calculation demonstrates while
loops:
eps = 1; while (1+eps) > 1 eps = eps/2; end eps = eps*2
all
Test to determine if all elements are nonzero
any
Test for any nonzeros
break
Break out of flow control structures
end
Terminate for, while, switch, and if statements or
indicate last index
for
Repeat statements a specific number of times
if
Conditionally execute statements
return
Return to the invoking function
switch
Switch among several cases based on expression