Guys, this seems very simple and trivial, but I'm having a great amount of difficult with this
I have this for loop below, how can I write it in the while form?
for k=1:3:9
x=k^2
end

 Akzeptierte Antwort

per isakson
per isakson am 31 Mai 2015
Bearbeitet: per isakson am 31 Mai 2015

0 Stimmen

Something like this might do it
k = 1;
while k <= 9
x = k^2
k = k+3;
end

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-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