# How to include a MATLAB (.eps) graphic

Can somebody give me a step-by-step guidance of how to include my .eps graphic, which I have created with MATLAB, in my LaTeX document?

I have heard of matlab2tikz, a script which is available on mathworks file exchange. But is it really necessary? If it is, can you explain to me step by step how to get from download to included graphic? I'm new to LaTeX and I feel somewhat overwhelmed. Thanks in advance!

• if you have saved it as file.eps use \includegraphics{file.eps] in your latex document (which needs \usepackage{graphicx}. What did you try? – David Carlisle Jan 31 '17 at 22:12
• So I have just tried: \begin{figure} \centering \includegraphics[width=100mm, height=50mm]{figure1.eps} \caption{mycaption} \label{fig1} \end{figure} . It's working. But if it is so easy, what is the matlab2tikz tool even for? – user123551 Feb 1 '17 at 8:56
• By converting the matlab code to tikz (which is tex) you can include it as tex and then get more control (in particular set any text using tex typesetting rather than including it as an image, and for some cases (if matlab makes an eps that is a bitmap) you get better text and rendering, but for the vast majority of people whove been doing this for years, including an eps works fine, On forums like this things are slanted towards tikz and to more involved tex solutions as that is the subject of discussion, but just using an eps file is certainly what most people using matlab and latex do:-) – David Carlisle Feb 1 '17 at 9:01
• Do not specify both width= and height= or you will distort the image, just use one or the other. – David Carlisle Feb 1 '17 at 9:02
• @Luk If you want an easier approach, you can export the image in any format (e.g. png or jpg), then you can include it as shown in this answer to my question. – Diaa Feb 1 '17 at 9:34

If you have saved it as file.eps use
 \includegraphics[width=100mm]{file.eps}

in your latex document (which needs \usepackage{graphicx}) and the image should be included.
As well as matlab2tikz you will see other mechanisms that also aim to get the data into TeX rather than being plotted by matlab, in particular some people avoid the matlab plotting altogether, and get matlab just to write out a table of data values and then plot that data using tikz (or its sibling, the pgfplots plotting package) Again this gives more TeX-level control, and may be particularly useful if not all the data in the document is matlab generated and you want to give all the plots a consistent look.