flatten function

Flatten Matrices/Arrays