:orphan:
# PetscStartMatlab
starts up MATLAB with a MATLAB script 
## Synopsis
```
PetscErrorCode PetscStartMatlab(MPI_Comm comm, const char machine[], const char script[], FILE **fp)
```
Logically Collective, but only MPI rank 0 in the communicator does anything


## Input Parameters

- ***comm -*** MPI communicator
- ***machine -*** optional machine to run MATLAB on
- ***script -*** name of script (without the .m)



## Output Parameter

- ***fp -*** a file pointer returned from `PetscPOpen()`





## Notes
This starts up a "regular" MATLAB interactive session, it does not start the MATLAB Engine, this is controlled with `PetscMatlabEngine`

Warning, this overwrites your `matlab/startup.m` file

The script must be in your MATLAB path or current directory


## See Also
 `PetscPOpen()`, `PetscPClose()`, `PetscMatlabEngine`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/fileio/smatlab.c.html#PetscStartMatlab">src/sys/fileio/smatlab.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/fileio/smatlab.c)


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