You can use share/petsc/matlab/PetscBinaryWrite.m.
matlab> PetscBinaryWrite('matrix.petsc', sparse(A))
Then load it with MatLoad in PETSc.
Ahmed Mansur <ahmedlp9 at gmail.com> writes:
> How to import a sparse matrix from Matlab using C++ and PETSC , if anyone
> has any example code, thanks