different combination of numbers

I want to enter 3 numbers and get different combination of numbers which includes duplicate numbers,I mean for numbers(1,2,3) we have 9 combination and i want them all in matrix.how can i have it?
Regards

 Accepted Answer

perms([1 2 3])
Refer perms

2 Comments

although that does not include duplicate numbers
salim
salim on 5 Dec 2012
Edited: salim on 5 Dec 2012
thank you about your answer but i think with this example i can explain it more . The command perms([2 4 6]) returns all the permutations of the numbers 2, 4, and 6:
6 4 2
6 2 4
4 6 2
4 2 6
2 4 6
2 6 4
perms returns all permutation of numbers,but i want combination such as 6 6 6 and 4 4 4 and 2 2 2 too.Am i supposed to program it by my self?

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!