Hello,
I would like to have a for loop with its index k ranging from e.g. 8 to 1 such that in the first iteration k=8, in the second iteration k=4, in the 3rd iteration k=2, and in the forth iteration k=1. I would appreciate your help. Thanks.

 Akzeptierte Antwort

Matt J
Matt J am 24 Jun. 2015

0 Stimmen

for k=2.^(3:-1:0)
....
end

Weitere Antworten (0)

Kategorien

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

Gefragt:

Mnr
am 24 Jun. 2015

Kommentiert:

Mnr
am 24 Jun. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by