how to declare two variables together in the for loop

1 visualizzazione (ultimi 30 giorni)
how to declare two variables together in the for loop
  1 Commento
Rik
Rik il 6 Gen 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.

Accedi per commentare.

Risposte (1)

Stephen23
Stephen23 il 6 Gen 2018
R = 1:4;
C = 2:5;
for k = 1:numel(C)
r = R(k);
c = C(k);
...
end

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by