petsc-3.7.1 2016-05-15
Report Typos and Errors

# PetscViewerMatlabOpen

Opens a Matlab .mat file for output

### Synopsis

    PetscErrorCode  PetscViewerMatlabOpen(MPI_Comm comm,const char name[],PetscFileMode type,PetscViewer *binv)

Collective on MPI_Comm Many br

### Input Parameters

| comm | - MPI communicator Many br
| name | - name of file Many br
| type | - type of file Many br

       FILE_MODE_WRITE - create new file for MATLAB output

       FILE_MODE_READ - open existing file for MATLAB input

       FILE_MODE_WRITE - open existing file for MATLAB output

### Output Parameter

binv -PetscViewer for MATLAB output to use with the specified file Many br

Many br

Note: This PetscViewer should be destroyed with PetscViewerDestroy(). Many br

For writing files it only opens the file on processor 0 in the communicator. Many br

This only saves Vecs it cannot be used to save Mats. We recommend using the PETSCVIEWERBINARY to save objects to be loaded into MATLAB Many brinstead of this routine. Many br

### See Also

PetscViewerASCIIOpen(), PetscViewerPushFormat(), PetscViewerDestroy(), PETSCVIEWERBINARY, PetscViewerBinaryOpen()
VecView(), MatView(), VecLoad(), MatLoad() Many br

Level:beginner
Location:src/sys/classes/viewer/impls/matlab/vmatlab.c
Index of all Viewer routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/dm/examples/tutorials/ex1.c.html
src/snes/examples/tutorials/ex30.c.html