How to these permutations?

Hello,
Suppose I have a vector of N elements, and I need to find all possible permutations {N \choose n} for n=1,2, ..., N. How can I do that?
Example: Suppose I have the vector [1 2 3], then all possible permutations are: 123 (n=3), 12, 13, 23, (n=2), 1, 2, 3 (n=1)
Thanks

2 件のコメント

Oleg Komarov
Oleg Komarov 2012 年 5 月 27 日
doc nchoosek
S. David
S. David 2012 年 5 月 28 日
I did not know it is built-in in MATLAB. Thanks

回答 (1 件)

Junaid
Junaid 2012 年 5 月 27 日

1 投票

Take a look over this link. This might be useful for you.

1 件のコメント

S. David
S. David 2012 年 5 月 28 日
It is not working. I do not know why. I think choosek does the job. Thanks anyway

この質問は閉じられています。

タグ

質問済み:

2012 年 5 月 27 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by