read in matrix