how to generate numbers from 1 to 5 with respect to 1 row versus 10 columns.
5 次查看(过去 30 天)
显示 更早的评论
could anyone help me how to generate numbers from 1 to 5 repeatedly in a randon manner with respect to 1 row versus 10 columns.
0 个评论
回答(1 个)
KALYAN ACHARJYA
2019-5-28
编辑:KALYAN ACHARJYA
2019-5-28
min=1; max=5;
result=min+(max-min)*rand(1,10)
Is this you looking for?
Or
>> randi(5,1,10)
Result:
ans =
1 4 3 4 4 5 5 2 4 1
6 个评论
KALYAN ACHARJYA
2019-5-28
>> data=1:5;
>> result=[data(randperm(5)),data(randperm(5))];
I tried to manually set, is it OK?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!