how to create while statement

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일

1 개 추천

while ~all(A==1)
% code here that changes A
end

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by