how to declare two variables together in the for loop

1 Ansicht (letzte 30 Tage)
Prabha Kumaresan
Prabha Kumaresan am 6 Jan. 2018
Kommentiert: Rik am 6 Jan. 2018
how to declare two variables together in the for loop
  1 Kommentar
Rik
Rik am 6 Jan. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

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

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by