Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

how to create matrix iteration

1 Ansicht (letzte 30 Tage)
Light
Light am 7 Jun. 2013
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

Antworten (1)

Hugo
Hugo am 7 Jun. 2013
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

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by