k permutation of an n-membered vector

Version 1.0.2 (1,28 ko) par WinCento99
"perms" requires a lot of memory for vectors greater than 10 members.If you need limited permutations(k) of a vector, you can use "perms_k".
5 téléchargements
Mise à jour 24 mars 2023

Afficher la licence

For use with permutation of 6 and vector with 3 members:
perms_k([700 2 nan],6)
The output is as follows:
ans =
700 NaN 2
2 NaN 700
700 2 NaN
NaN 2 700
NaN 700 2
2 700 NaN
If you need indexes:
[~ , index] = perms_k([700 2 nan],6)
and output is:
index =
1 3 2
1 2 3
2 3 1
3 2 1
2 1 3
3 1 2
If the amount of permutation required is greater than the factorial of the number of members:
perms_k([700 2 nan],7)
or
[~ , index] = perms_k([700 2 nan],7)
You receive an error with the following content:
# Your chosen k is greater than the number of permutations. 7 is greater of 6.

Citation pour cette source

WinCento99 (2024). k permutation of an n-membered vector (https://www.mathworks.com/matlabcentral/fileexchange/126769-k-permutation-of-an-n-membered-vector), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2018b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Tags Ajouter des tags

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.0.2

Its dimensions were improved.

1.0.1

I added a photo :)

1.0.0