How to generate all permutations of numbers if I have a number twice?
1 次查看(过去 30 天)
显示 更早的评论
I cannot use perms([1 2 2]) because I dont want 1,2,2 twice.
0 个评论
回答(1 个)
Paolo
2018-7-7
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!