필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

how to create matrix iteration

조회 수: 1 (최근 30일)
Light
Light 2013년 6월 7일
Give me structure please
A=[-1,1,1;0,-1,0;0,0,-1;1,0,0]
iteration command??
some operation
if whole matrix not 0, it will be iterated again
or if whole matrix 0 stop
how can i iterate it

답변 (1개)

Hugo
Hugo 2013년 6월 7일
You can use while as follows
while any(A)
end
any(A) assumes first that all values of A can be converted to type logical. This conversion turns any number different from zero into 1. Then, if there is any element of A that is 1, then any(A)=1 and the iteration continues.
Is this what you want?
Best regards

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by