From: Jack on
Hi;

This question seems easy but do you know how to find all possible permutations for FOUR variables where each variable can take a value from 1 to 10. I want to put all posible permuatations in a single matrix.
From: Oleg Komarov on
"Jack " <jack_sama_1981(a)yahoo.com> wrote in message <i08fup$ri0$1(a)fred.mathworks.com>...
> Hi;
>
> This question seems easy but do you know how to find all possible permutations for FOUR variables where each variable can take a value from 1 to 10. I want to put all posible permuatations in a single matrix.

doc perms

Oleg
From: Roger Stafford on
"Jack " <jack_sama_1981(a)yahoo.com> wrote in message <i08fup$ri0$1(a)fred.mathworks.com>...
> Hi;
>
> This question seems easy but do you know how to find all possible permutations for FOUR variables where each variable can take a value from 1 to 10. I want to put all posible permuatations in a single matrix.
- - - - - - - - - -
If you want each of four variables to be able to assume any value from 1 to 10, independently of the other variables, then you want all possible combinations, of which there are 10^4 = 10000. If you want to restrict them so that no two are alike, then there would be 10!/6! = 5040 of them. Which, if either of these, are you interested in?

Roger Stafford
From: Roger Stafford on
"Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <i08jh7$er3$1(a)fred.mathworks.com>...
> ..... If you want to restrict them so that no two are alike, then there would be 10!/6! = 5040 of them.
- - - - - -
If it's the second of the above, you will find a function that does this at:

http://www.mathworks.com/matlabcentral/fileexchange/24325-combinator-combinations-and-permutations

by Matt Fig

Roger Stafford
From: Jack on
"Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <i08kbd$6la$1(a)fred.mathworks.com>...
> "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <i08jh7$er3$1(a)fred.mathworks.com>...
> > ..... If you want to restrict them so that no two are alike, then there would be 10!/6! = 5040 of them.
> - - - - - -
> If it's the second of the above, you will find a function that does this at:
>
> http://www.mathworks.com/matlabcentral/fileexchange/24325-combinator-combinations-and-permutations
>
> by Matt Fig
>
> Roger Stafford

Thanks a lot Roger; this is exactly what I needed.