How to separate a number in 5 in for loop
1 次查看(过去 30 天)
显示 更早的评论
Let’s say we have a for loop for y, y=0:10
the second for loop is x=0:y
I want x separate in 5 to each y
For example, for y=1, x1=0.2,x2=0.4....x5=1; for y=2,x1=0.4.....x5=2
0 个评论
采纳的回答
Walter Roberson
2018-10-4
x1 = 0.2 * y;
x2 = 0.4 * y;
x3 = 0.6 * y;
x4 = 0.8 * y;
x5 = 1.0 * y;
But consider
x = (0.2:0.2:1) * y;
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!