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

3 visualizzazioni (ultimi 30 giorni)
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.

Risposte (1)

Marta Salas
Marta Salas il 18 Giu 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));

Categorie

Scopri di più su Discrete Math in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by