Filter löschen
Filter löschen

Alphabetical random permutation

1 Ansicht (letzte 30 Tage)
Muammar
Muammar am 7 Dez. 2011
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

Akzeptierte Antwort

the cyclist
the cyclist am 7 Dez. 2011
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 Kommentare
Muammar
Muammar am 7 Dez. 2011
Thank you..
Muammar
Muammar
Muammar am 7 Dez. 2011
How about random permutation for alphabet?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Sean de Wolski
Sean de Wolski am 7 Dez. 2011
So:
alphabet = 'A':'Z';
alphabet = alphabet(randperm(numel(alphabet)))

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by