while

while Repeat an indefinite number of times.
The general form of a while statement is:

while
statements
END

The statements are executed while the real part of the expression
has all non-zero elements. The expression is usually the result of
expr rop expr rop is ==, <, >, <=, >=, or ~=.

The BREAK statement can be used to terminate the loop prematurely.

example (assuming A already defined):

E = 0*A; F = E + eye((E)); N = 1;
while norm(E+F-E,1) > 0,
E = E + F;
F = A*F/N;
N = N + 1;
end

See also for, , switch, break, end.

You might also be interested in :  MATLAB Commands

Yorumlar Kapalı.