output to matlab readable format
Yixun Liu
enjoywm at cs.wm.edu
Tue Feb 24 13:57:42 CST 2009
Hi,
I use the following code to output matrix into file which can be read by
matlab,
PetscViewer aviewer;
PetscViewerCreate(PETSC_COMM_WORLD, &aviewer);
PetscViewerSetType(aviewer, PETSC_VIEWER_ASCII);
//PetscObjectSetName((PetscObject)sparseMechanicalStiffnessMatrix,
aname);
PetscViewerSetFormat(aviewer, PETSC_VIEWER_ASCII_MATLAB);
PetscViewerFileSetName(aviewer, aname);
MatView(sparseMechanicalStiffnessMatrix, aviewer);
PetscViewerDestroy(aviewer);
The error is ASCII format file doesn't allow the matrix exceeds 512
rows. So I change PETSC_VIEWER_ASCII to PETSC_VIEWER_BINARY, but it seem
that PETSc outputs to screen.
Thanks.
More information about the petsc-users
mailing list