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

Answers (1)

How about calling unique function after perms?
data = unique(perms([1 2 2]),'rows');
data =
1 2 2
2 1 2
2 2 1

Categories

Find more on Elementary Math in Help Center and File Exchange

Asked:

on 7 Jul 2018

Answered:

on 7 Jul 2018

Community Treasure Hunt

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

Start Hunting!