'Sparse matrices are 2D
See docstring for VarReader4.read_sparse_array'

def write_sparse(self, arr, name):

    A = arr.tocoo()
    imagf = (A.dtype.kind == 'c')
    ijv = np.zeros(((A.nnz + 1), (3 + imagf)), dtype='f8')
    ijv[:(-1), 0] = A.row
    ijv[:(-1), 1] = A.col
    ijv[:(-1), 0:2] += 1
    if imagf:
        ijv[:(-1), 2] = A.data.real
        ijv[:(-1), 3] = A.data.imag
    else:
        ijv[:(-1), 2] = A.data
    ijv[(-1), 0:2] = A.shape
    self.write_header(name, ijv.shape, P=miDOUBLE, T=mxSPARSE_CLASS)
    self.write_bytes(ijv)
