Question with vectorisation?
1 次查看(过去 30 天)
显示 更早的评论
Hello This is the code I have.
n = 1:1000
A(n,1) = ceil(rand*5);
What this does is it finds a random value between 1 and 5, and places that same value in all rows 1 to 1000, col 1 of A. This is not what I wanted it to do. I wanted it to put a different random number each time for each row of A from 1 to 1000. I want to use vectorisation (and not for loops) because otherwise it is too slow. What step am I missing?
0 个评论
回答(1 个)
另请参阅
类别
在 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!