Fixed the matrix to csv function to remove an unneeded comma.