Home > MATLAB, Technology, Tips > MATLAB to PSTricks

## MATLAB to PSTricks

So, I’ve been trying to include more good looking figures into $\LaTeX$. I came across an script to convert from MATLAB to pstricks. However, it looks like it is not maintained anymore.

However, I made some little changes and fix a bug that I found. So, I want to put it here for anyone who is interested in use it.

The changes from the original:

• The standalone file generation uses the `standalone` package, so (in theory) can compile faster. Because, for some strange reason, when I include these files into any document it takes forever to compile.
• Now, the script can set any option from the options data structure (see the file to understand what I’m saying) individually, instead of passing the whole thing.
• I fix a bug for data points outside of the axes not appearing.

The script is really good, although it has some limitations. Still, I will try to keep this entry up to date if I made some changes to the file.

So the script is here: fig2texps. To use the script easily call

```h = figure; % a handle for the figure
fig2texps(h,'file.tex'); % basic invocation
```

To check all the options you can set see the `globals` struct in line 187.

Hope that helps… :mrgreen: