How do I convert from a while loop to a for loop?

2 Ansichten (letzte 30 Tage)
Jillian Sweatt
Jillian Sweatt am 4 Nov. 2015
Beantwortet: James Tursa am 4 Nov. 2015
i = 0;
while (i < 110)
fprintf('i = %d\n',i)
i = i + 11;
end

Akzeptierte Antwort

James Tursa
James Tursa am 4 Nov. 2015
for i=0:11:109
fprintf('i = %d\n',i)
end

Weitere Antworten (0)

Kategorien

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

Community Treasure Hunt

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

Start Hunting!

Translated by