how to declare two variables together in the for loop

조회 수: 2 (최근 30일)
Prabha Kumaresan
Prabha Kumaresan 2018년 1월 6일
댓글: Rik 2018년 1월 6일
how to declare two variables together in the for loop
  댓글 수: 1
Rik
Rik 2018년 1월 6일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

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

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by