There are a number of factorial(n) permutations for n elements. This function return the kth permutation in lexicographical order.
Should work on all Matlab versions.
W He (2019). kth permutation in lexicographical order (https://www.mathworks.com/matlabcentral/fileexchange/<...>), MATLAB Central File Exchange. Retrieved March 13, 2019.
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!