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 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Elementary Math 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by