MATLAB Answers


how to create matrix iteration

Asked by Light
on 7 Jun 2013
This question is closed and may reopen in the future if edited.

Give me structure please


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


No products are associated with this question.

1 Answer

Answer by Hugo
on 7 Jun 2013

You can use while as follows

while any(A)

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


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!