mat2vec function

Creates a vector from a matrix