Borrar filtros
Borrar filtros

How to generate all permutations of numbers if I have a number twice?

1 visualización (últimos 30 días)
Mr M.
Mr M. el 7 de Jul. de 2018
Respondida: Paolo el 7 de Jul. de 2018
I cannot use perms([1 2 2]) because I dont want 1,2,2 twice.

Respuestas (1)

Paolo
Paolo el 7 de Jul. de 2018
How about calling unique function after perms?
data = unique(perms([1 2 2]),'rows');
data =
1 2 2
2 1 2
2 2 1

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by