Create a for loop with two changing variables

I want to create a loop with 2 variables that change value every loop.
Currently I have:
for nF = [31 30 33 32 18 21 19 20 23 25 22 24 26 27 28 29];
but I would also like a variable 'i' to count from 1 to 16 (count each loop).
Thanks.

 채택된 답변

Walter Roberson
Walter Roberson 2016년 1월 6일

0 개 추천

nfvals = [31 30 33 32 18 21 19 20 23 25 22 24 26 27 28 29];
for i = 1 : length(nfvals)
nf = nfvals(i);
...
end

추가 답변 (0개)

카테고리

도움말 센터File 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