how to create while statement

1 回表示 (過去 30 日間)
Salvatore Mazzarino
Salvatore Mazzarino 2012 年 9 月 20 日
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?

採用された回答

Matt Fig
Matt Fig 2012 年 9 月 20 日
編集済み: Matt Fig 2012 年 9 月 20 日
while ~all(A==1)
% code here that changes A
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by