Improved method readMatrix