Added method to read matrix from file