how to create while statement

1 Ansicht (letzte 30 Tage)
Salvatore Mazzarino
Salvatore Mazzarino am 20 Sep. 2012
I'd create while statement that should works like:
A is an column vector
while [every A element is not equals to 1]
do-something
end
the while statement have to be execute until when A vector is composed of all element 1 like A=[1 1 1 1 1]. I tried with all function but it didn't worked.any idea?

Akzeptierte Antwort

Matt Fig
Matt Fig am 20 Sep. 2012
Bearbeitet: Matt Fig am 20 Sep. 2012
while ~all(A==1)
% code here that changes A
end

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by