I need to remove randi from for loop
显示 更早的评论
I need to remove randi from the for loop. Any help would appreciate.
I=30;
t1=randi([1 5],1,I);
t2=randi([6 10],1,I);
for i=1:I
TD(1,i)=randi([t1(1,i) t2(1,i)],1,1);
end
2 个评论
Star Strider
2018-1-28
That seems easy enough to do, although it would be interesting to know the reason you want to do it.
It would be best leave your code as it is, and simply overwrite ‘TD’ with something else.
采纳的回答
更多回答(1 个)
Star Strider
2018-1-28
The code you posted does exactly what you describe.
Try this instead of the loop if you simply want something different:
TD = randi(10, 1, I);
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!