Creates a list from a matrix