Changed character matrix to matrix with integers