I have a vector x = 1:n and I need to compute all sets from it. So for example x = [1 2 3 4] should produce:
[1] [2] [3] [4]
[1 2] [3 4]
[1 2] [3] [4]
[1 3] [2 4]
[1 3] [2] [4]
[1 4] [2 3]
[1 4] [2] [3]
[2 3] [1] [4]
[2 4] [1] [3]
[3 4] [1] [2]
[1 2 3] [4]
[1 2 4] [3]
[1 3 4] [2]
[2 3 4] [1]
[1 2 3 4]

2 件のコメント

Steven Lord
Steven Lord 2015 年 10 月 18 日
How large is n going to be in your real (not example) case? That will determine if such a scenario is feasible.
Does order matter? You have both [3 4][1 2] and [1 2][3 4] in your list, but you don't have for example [4][2][3][1].
Paul
Paul 2015 年 10 月 19 日
編集済み: Paul 2015 年 10 月 19 日
Sorry my bad ... order doesn't matter so [3 4] [1 2] and [1 2] [3 4] are the same set. In my cases n<= 15.

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2015 年 10 月 19 日
編集済み: Walter Roberson 2015 年 10 月 19 日

0 投票

1 件のコメント

Paul
Paul 2015 年 10 月 19 日
Exactly what I was looking for Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

製品

質問済み:

2015 年 10 月 18 日

コメント済み:

2015 年 10 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by