Alphabetical random permutation
조회 수: 1 (최근 30일)
이전 댓글 표시
Hii...
in MATLAB, how to perform permutation and random permutation for alphabet?
ex: I want to do random permutation for [A B C], and the result should be [A B C], [A C B], [B A C],....,etc. If my question is not clear please inform me, because I just start learning MATLAB.
Thank you Muammar
댓글 수: 0
채택된 답변
the cyclist
2011년 12월 7일
Will this do?
>> perms('ABC')
Be careful if that input gets too long. The resulting attempt at creating all the permutations (which will be ginormous) will bring MATLAB to a grinding halt. Read "doc perms" for details.
추가 답변 (1개)
Sean de Wolski
2011년 12월 7일
So:
alphabet = 'A':'Z';
alphabet = alphabet(randperm(numel(alphabet)))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!