A simple way to proceed is to use 
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerBinaryOpen.html

On Jul 27, 2014, at 10:18 AM, Sun, Hui <[email protected]> wrote:

> I try to create some binary output for MATLAB with the following code. 
> 
> PetscViewer viewer = PETSC_VIEWER_BINARY(PETSC_COMM_WORLD);
> MatView(A,viewer);
> VecView(v,viewer);
> PetscViewerDestroy(&viewer);
> 
> However it gives me an error, which is the following:
> 
> interface_fs.c:215:26: warning: implicit declaration of function 
> 'PETSC_VIEWER_MATLAB' is invalid in C99 [-Wimplicit-function-declaration]
>    PetscViewer viewer = PETSC_VIEWER_MATLAB(PETSC_COMM_WORLD);
>                         ^
> interface_fs.c:215:17: warning: incompatible integer to pointer conversion 
> initializing 'PetscViewer' (aka 'struct _p_PetscViewer *') with an expression 
> of type 'int'
>      [-Wint-conversion]
>    PetscViewer viewer = PETSC_VIEWER_MATLAB(PETSC_COMM_WORLD);
> 
> 
> I'm wondering what is the correct way to do this? Thank you!

Reply via email to