Hi, I have a matrix A
A = 1 4 2 3 4 3 1 2 3 2 4 1 2 1 3 4
How to make different groups of two elements from this matrix? But the chosen elements (from the matrix A) have to be adjacent in the matrix A. for example A(1,1) & A(1,2) are adjacent and so they can be chosen. and A(1,1) & A(4,3) can't be chosen to make a group. I'd like to create a function which randomly choose these elements from A. And the function generates an other matrix containing the (2 by 2) different groupements randomly created.
example "function group":
V=group(A)V= 1 4 3 2 4 2 3 1 2 1 4 3 3 2 1 4
This new V matrix is made of groups
A(1,1)&A(2,1)A(2,2)&A(4,1)A(1,2)&A(1,3)...
Hope you understand what I mean. In fact we randomly choose pairs of elements in the matrix A. thank you!
Best Answer