what I want to do is to do the following in the simplest way in Matlab
let's suppose we have two arrays {1,2,3} {4,5,6}.
The algorithm should give me all bijections:
1-4 2-5 3-6 / 1-4 2-6 3-5 / 1-5 2-4 3-6 / 1-5 2-6 3-4 / 1-6 2-5 3-4 / 1-6 2-4 3-5
On
This is equivalent to getting all permutations of the second array, and there is a very convenient function, perms, for that.
Create a 3D matrix using perms as suggested by trutheality and repmat to duplicate the first matrix: