How can I increment different values for every iteration to a for loop?
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Marc Edwin Montilla
le 26 Juil 2014
Réponse apportée : fengwuxiaoli
le 4 Déc 2017
Hi! I'm at stall of my program because of this. I would like to increment different values for every iteration in a for loop but sad to say I can't find a solution. BTW, I'm still a newbie. Here is an example:
a = [1 3 4 7 8 10 14 17 21 26];
for k=a(1):X:a(end) %X is the increment
disp(k) %displays k
end
I need to obtain 10 iterations that displays k which is the values of a. Hope you can help me.
0 commentaires
Réponse acceptée
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!