Cloning array for creating a matrix