필터 지우기
필터 지우기

Alphabetical random permutation

조회 수: 1 (최근 30일)
Muammar
Muammar 2011년 12월 7일
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

채택된 답변

the cyclist
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.
  댓글 수: 2
Muammar
Muammar 2011년 12월 7일
Thank you..
Muammar
Muammar
Muammar 2011년 12월 7일
How about random permutation for alphabet?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2011년 12월 7일
So:
alphabet = 'A':'Z';
alphabet = alphabet(randperm(numel(alphabet)))

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by