How to get all possible arrangements for n=10 and more

3 Ansichten (letzte 30 Tage)
Grace
Grace am 18 Jun. 2014
Beantwortet: Marta Salas am 18 Jun. 2014
Hi, I wish to get all the possible arrangements for n=10 and more,I used permutation and the output shows me:
>> perms(1:10)
Out of memory. Type HELP MEMORY for your
options.
Error in perms (line 34)
P = V(P);
What can I do except for the permutation in order for me to get all possible arrangements for n=10 and more?Thanks.

Antworten (1)

Marta Salas
Marta Salas am 18 Jun. 2014
http://www.mathworks.com/help/matlab/ref/perms.html [Limitations: perms(v) is practical when length(v) is less than about 10.]
It's quite a big matrix, but it should be able to do the operation if you don't have lots of data already loaded on your workspace.
For n=10 number of permutations is 10! = 3628800 so the size of v is 3628800x10, by default it will do it on double so 0.27Gb. Have you tried to do the operation in uint8?
v = perms(uint8(1:10));

Kategorien

Mehr zu Discrete Math finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by