Effacer les filtres
Effacer les filtres

a question about the for loop index

1 vue (au cours des 30 derniers jours)
Mnr
Mnr le 24 Juin 2015
Commenté : Mnr le 24 Juin 2015
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.

Réponse acceptée

Matt J
Matt J le 24 Juin 2015
for k=2.^(3:-1:0)
....
end
  1 commentaire
Mnr
Mnr le 24 Juin 2015
Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by