column vector with specified number
1 次查看(过去 30 天)
显示 更早的评论
hi everyone, i need to generate column vector of 10 elements with only the number 2 and 3 ,it need to indexed randomly. well i have tried rand-rem, rbinom (x,y,z) is not working in my matlab, how I define only the numbers 2 and 3
solution a=[2 3 2 2 3 3 3 2 2 2 ] randomly
thanks
0 个评论
回答(2 个)
Walter Roberson
2017-10-18
a = randi([2 3], 1, 10);
"rbinom (x,y,z) is not working in my matlab"
rbinom is part of the R language, not part of MATLAB.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dialog Boxes 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!