How to generate all permutations of numbers if I have a number twice?
    2 views (last 30 days)
  
       Show older comments
    
I cannot use perms([1 2 2]) because I dont want 1,2,2 twice.
0 Comments
Answers (1)
  Paolo
      
 on 7 Jul 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
0 Comments
See Also
Categories
				Find more on Discrete Math in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!