how to declare two variables together in the for loop

how to declare two variables together in the for loop

1 comentario

Rik
Rik el 6 de En. de 2018
It works the exact same way as outside a loop. The only thing to keep in mind is that the loop is repeated, so your assignment might be overwritten.

Iniciar sesión para comentar.

Respuestas (1)

R = 1:4;
C = 2:5;
for k = 1:numel(C)
r = R(k);
c = C(k);
...
end

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 6 de En. de 2018

Comentada:

Rik
el 6 de En. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by