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 visualización (últimos 30 días)
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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Abr. de 2022
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 comentarios

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Elementary Math en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by