Hi everyone, I have a vector of 5 columns, x=[1 2 3 4 5]; i want to create all possible combinations of first element with the other remaining.

1 回表示 (過去 30 日間)
Hi everyone, I have a vector of 5 columns, x=[1 2 3 4 5]; i want to create all possible combinations of first element with the other remaining and then all possible combinations of 2nd element with the other 4 and so on all the combinations of the remaining elements with the other remaining in the vector.

採用された回答

Walter Roberson
Walter Roberson 2022 年 4 月 11 日
x = 1:5
x = 1×5
1 2 3 4 5
nchoosek(x, 2)
ans = 10×2
1 2 1 3 1 4 1 5 2 3 2 4 2 5 3 4 3 5 4 5
  4 件のコメント
Maimoona Asad
Maimoona Asad 2022 年 4 月 11 日
how can i access indivual element of this array

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeElementary Math についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by