Conversion to matrix.