フィルターのクリア

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 Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by