How do I include a MATLAB figure in a LaTeX document?

890 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
回答済み: Julian Hapke 2023 年 5 月 2 日
I would like to include a MATLAB figure in a LaTeX document.

採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
The best way to do this would be to export your figure into an Encapsulated PostScript (EPS) format file and then include the EPS file in the LaTeX document. You can export a figure into a EPS format using the PRINT command as follows:
plot(1:10)
print -deps epsFig
This will generate a file called epsFig.eps in your current working directory. You can then include this eps file in your LaTeX document.
One method to include an EPS figure in your LaTeX 2E document is as follows:
1. Include the following line before the \begin{document} statement
\usepackage{graphicx}
2. Use the following template code to include any figure:
\begin{figure}
\centering
\includegraphics{Figure name without .eps extension}
\caption{Insert caption}
\end{figure}
For more information on LaTeX, refer to the TeX Users Group at http://www.tug.org or the Comprehensive TeX Archive Network at http://www.ctan.org
  1 件のコメント
Walter Roberson
Walter Roberson 2019 年 5 月 14 日
Youwei Liang comments to Kashif:
"print -depsc epsFig" for color figure

サインインしてコメントする。

その他の回答 (1 件)

Julian Hapke
Julian Hapke 2023 年 5 月 2 日
I recommend matlab2tikz from the FileExchange: matlab2tikz
Those plots integrate into the whole LaTeX style very well.

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by