output matrix file