:orphan:
# PETSC_VIEWER_MATLAB_
Creates a `PETSCVIEWERMATLAB` `PetscViewer` shared by all processors in a communicator. 
## Synopsis
```
PetscViewer PETSC_VIEWER_MATLAB_(MPI_Comm comm)
```
Collective


## Input Parameter

- ***comm -*** the MPI communicator to share the Matlab `PetscViewer`



## Options Database Key

- ***-viewer_matlab_filename <name> -*** name of the Matlab file



## Environmental variable

- ***`PETSC_VIEWER_MATLAB_FILENAME` -*** name of the Matlab file





## Note
Unlike almost all other PETSc routines, `PETSC_VIEWER_MATLAB_()` does not return
an error code.  The matlab PetscViewer is usually used in the form
```none
XXXView(XXX object, PETSC_VIEWER_MATLAB_(comm));
```

Use `PETSC_VIEWER_SOCKET_()` or `PetscViewerSocketOpen()` to communicator with an interactive MATLAB session.


## See Also
 `PETSC_VIEWER_MATLAB_WORLD`, `PETSC_VIEWER_MATLAB_SELF`, `PetscViewerMatlabOpen()`, `PetscViewerCreate()`,
`PetscViewerDestroy()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/impls/matlab/vmatlab.c.html#PETSC_VIEWER_MATLAB_">src/sys/classes/viewer/impls/matlab/vmatlab.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/viewer/impls/matlab/vmatlab.c)


[Index of all Viewer routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
