View all files | ||||
The updater in matlab2tikz 0.6.0 (and older) no longer works. Please update manually if you are not using matlab2tikz 1.0.0 or newer!
matlab2tikz is a MATLAB(R) script to convert native MATLAB(R) figures to TikZ/Pgfplots figures that integrate seamlessly in LaTeX documents.
To download the official releases and rate matlab2tikz, please visit its page on FileExchange.
matlab2tikz converts most MATLAB(R) figures, including 2D and 3D plots. For plots constructed with third-party packages, however, your mileage may vary.
Make sure that your LaTeX installation is up-to-date and includes:
It is recommended to use the latest stable version of these packages. Older versions may work depending on the actual MATLAB(R) figure you are converting.
Typical usage of matlab2tikz consists of converting your MATLAB plot to a TikZ/LaTeX file and then running a LaTeX compiler to produce your document.
Generate your plot in MATLAB(R).
Run matlab2tikz, e.g. using
Add the contents of myfile.tex into your LaTeX source code, for example using \input{myfile.tex}. Make sure that the required packages (such as pgfplots) are loaded in the preamble of your document as in the example:
Most functions accept numerous options; you can check them out by inspecting their help:
Sometimes, MATLAB(R) plots contain some features that impede conversion to LaTeX; e.g. points that are far outside of the actual bounding box. You can invoke the cleanfigure function to remove such unwanted entities before calling matlab2tikz: