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!