Alphabetical random permutation
1 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
the cyclist
on 7 Dec 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.
More Answers (1)
Sean de Wolski
on 7 Dec 2011
So:
alphabet = 'A':'Z';
alphabet = alphabet(randperm(numel(alphabet)))
0 Comments
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!