Fractional steps in for loops
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello! This is the first time i am running fractional steps in for loop and i am not sure wheter this is just comepletely wrong or if this is the way it works.
yHH = 1:0.1:3;
for yH = 1:length(yHH)
Function(yH)
end
i get the following output
1
4
3
5
1
3
4
10
So what I was expecting was 1.1,1.2,1.3, etc....but I got the above numbers. Are those index numbers like for example below
1 = 1
2 = 1.1 % index 2 equates to the the second step within then range?
3 = 1.2
4 = 1.3
......
10 = 1.9
Appreciate any help! Thanks!
0 commentaires
Réponse acceptée
Voss
le 29 Déc 2021
yHH = 1:0.1:3;
for yH = 1:length(yHH)
display(yH);
end
compare to:
yHH = 1:0.1:3;
for yH = 1:length(yHH)
display(yHH(yH));
end
Plus de réponses (0)
Voir également
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!