Vector Permutation Algorithm Share & earn cash
By Chukwunomso Agunwamba
generate permutations of A.
This mathematical code is provided as is, for the end user to be able to use it
and to edit it for educational purposes. However, any modified version must
include my name as the original producer of the code.
The name of the mfile code is permutations. It has two input arguments.
The first input is the vector of numbers one desires to permute.
The second input is the number of columns to output. If the second input is
less than the length of the vector, the output will have partial permutation.
Usage syntax example:
A = [1:6];
r = length(A);
Ap = permutations(A,r);