My question is about including MATLAB exported images in LaTeX. I need it to be a vector graphic image. I have spent a lot of time trying to search for an answer. It is with great hesitation that I am asking this question, knowing that probably I would have skipped through some specific answer in my searches somehow. Nonetheless, I had found two solutions which are generally used:
- exporting MATLAB image as an
epsfile and then importing into LaTeX - using
matlab2tikzand exporting MATLAB image as atikzfile and then inputting thetikzfile
I tried to work with tikz. The images turn out to be good. but the text in the image is really weird and it took me an unnecessarily high amount of time to make it work- especially when it comes to adjusting the images in the document and placing multiple images together.
Theoretically, the eps solution sounded perfect and would be perfect if I could just export simply from matlab without any glitches and import into latex just like any other png or jpeg file. I was thinking that importing an image wouldn't be so difficult. SO here's what i did:
I exported my figure from MATLAB, both - directly by selecting .eps option, and by using export_fig. Then I imported it into LaTeX with
\begin{figure}[t]
\centering
\psset{xunit=1cm, yunit=1cm}
\begin{pspicture}(0,0)(5,2)
\rput[bl]{0}(0,0){\includegraphics[width=8\psxunit]{figures/myfig.eps}}
\rput[bl]{0}(8,0){\includegraphics[width=8\psxunit]{figures/myfig.eps}}
\end{pspicture}
\end{figure}
However, when i include it, the figure contains a white mesh as shown below, which shouldn't be there.

I tried a few solutions to this as follow:
- Replacing some lines of text in the
epsfile There are two problems with this method that I faced. The first is that this is a pain to do for every file (which would possibly be in hundreds) that I export. And the second is that despite doing this it still shows the mesh, but this time for only certain areas of the figure. I tried searching for more instances of the\f\fillline which the post talks about, but there exist none. - Using
openglas the renderer while exporting from as anepsfrom MATLAB. While using this solution did get rid of the lines,openglrenders the image as pixels and not as a vector graphic. So the quality of the image deteriorates on zooming. So this isn't acceptable.
My question is as follows: Is there an easy way to export an eps file from matlab and use it in LaTeX without having to change the text in the eps file?