How do I generate an unsorted permutation of integers in MATLAB 7.7 (R2008b)?
조회 수: 3 (최근 30일)
이전 댓글 표시
I would like to generate numbers, say, from 1 to 10. However, I would like to shuffle these numbers so that they are not in any sorted order.
채택된 답변
MathWorks Support Team
2010년 1월 7일
This enhancement has been incorporated in Release 2009b (R2009b). For previous product releases, read below for any possible workarounds:
The RANDPERM function can be used to generate a random permutation of integers. For example, the following statement creates a random permutation of integers from 1 to 10:
randperm(10)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!