Fractional steps in for loops
7 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Voss
2021 年 12 月 29 日
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
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!