Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
matlab figure in latex

Subject: matlab figure in latex

From: Angela Brands

Date: 20 Mar, 2010 16:21:03

Message: 1 of 8

hi there,

I want to include a matlab figure in a latex file...

Let say I want the figure: plot(1:10)
I've read that you can save this figure as an eps file using the command:

print -deps plot

So now I have a file called plot.eps

Then I need to iclude the figure as follows:

\documentclass{report}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\includegraphics{plot}
\end{figure}
This is a sample document.
\end{document}

but when I build it, I get an Error that says: file 'plot' not found

How can I get this right?? Does anyone have an idea...???

(I use TeXnicCenter and Miktex)

I would really apreciate help!

Thanks

kind regards
Angela



I use TeXnicCenter and Miktex

Subject: matlab figure in latex

From: Rune Allnor

Date: 20 Mar, 2010 16:36:08

Message: 2 of 8

On 20 Mar, 17:21, "Angela Brands" <angela_christ...@hotmail.com>
wrote:
> hi there,
>
> I want to include a matlab figure in a latex file...
>
> Let say I want the figure:  plot(1:10)  
> I've read that you can save this figure as an eps file using the command:
>
> print -deps plot
>
> So now I have a file called plot.eps
>
> Then I need to iclude the figure as follows:
>
> \documentclass{report}
> \usepackage{graphicx}
> \begin{document}
> \begin{figure}
> \centering
> \includegraphics{plot}
> \end{figure}
> This is a sample document.
> \end{document}
>
> but when I build it, I get an Error that says: file 'plot' not found

Specify the filename extension both when you plot the figure,

print -deps plot.eps

and when you include the plot in the LaTeX document:

\includegraphics{plot.eps}

Make sure you use a standard filename extension for the
format you print to, or LaTeX might become confused about
the format of the figure.

Rune

Subject: matlab figure in latex

From: Angela Brands

Date: 20 Mar, 2010 17:17:03

Message: 3 of 8

Rune Allnor <allnor@tele.ntnu.no> wrote in message <77e3275f-0021-4642-bd10-915bd5ed5d04@r27g2000yqn.googlegroups.com>...
> On 20 Mar, 17:21, "Angela Brands" <angela_christ...@hotmail.com>
> wrote:
> > hi there,
> >
> > I want to include a matlab figure in a latex file...
> >
> > Let say I want the figure:  plot(1:10)  
> > I've read that you can save this figure as an eps file using the command:
> >
> > print -deps plot
> >
> > So now I have a file called plot.eps
> >
> > Then I need to iclude the figure as follows:
> >
> > \documentclass{report}
> > \usepackage{graphicx}
> > \begin{document}
> > \begin{figure}
> > \centering
> > \includegraphics{plot}
> > \end{figure}
> > This is a sample document.
> > \end{document}
> >
> > but when I build it, I get an Error that says: file 'plot' not found
>
> Specify the filename extension both when you plot the figure,
>
> print -deps plot.eps
>
> and when you include the plot in the LaTeX document:
>
> \includegraphics{plot.eps}
>
> Make sure you use a standard filename extension for the
> format you print to, or LaTeX might become confused about
> the format of the figure.
>
> Rune

Thanks for your reply!! I did what you told me to do but still I get an Error with: file 'plot.eps' not found and now I also get a warning: unknown graphics extension: .eps

this is frustrating...

Subject: matlab figure in latex

From: Sadik

Date: 20 Mar, 2010 17:29:04

Message: 4 of 8

Hi,

I don't know whole a lot about the latex commands, but maybe the following is worth trying:

\DeclareGraphicsExtensions{.eps,.jpg}

This is right after \usepackage stuff.

Hope this helps.

Best.

Subject: matlab figure in latex

From: Bogdan Cristea

Date: 20 Mar, 2010 17:50:13

Message: 5 of 8

"Angela Brands" <angela_christina@hotmail.com> wrote in message <ho2vuf$pc0$1@fred.mathworks.com>...
> Rune Allnor <allnor@tele.ntnu.no> wrote in message <77e3275f-0021-4642-bd10-915bd5ed5d04@r27g2000yqn.googlegroups.com>...
> > On 20 Mar, 17:21, "Angela Brands" <angela_christ...@hotmail.com>
> > wrote:
> > > hi there,
> > >
> > > I want to include a matlab figure in a latex file...
> > >
> > > Let say I want the figure:  plot(1:10)  
> > > I've read that you can save this figure as an eps file using the command:
> > >
> > > print -deps plot
> > >
> > > So now I have a file called plot.eps
> > >
> > > Then I need to iclude the figure as follows:
> > >
> > > \documentclass{report}
> > > \usepackage{graphicx}
> > > \begin{document}
> > > \begin{figure}
> > > \centering
> > > \includegraphics{plot}
> > > \end{figure}
> > > This is a sample document.
> > > \end{document}
> > >
> > > but when I build it, I get an Error that says: file 'plot' not found
> >
> > Specify the filename extension both when you plot the figure,
> >
> > print -deps plot.eps
> >
> > and when you include the plot in the LaTeX document:
> >
> > \includegraphics{plot.eps}
> >
> > Make sure you use a standard filename extension for the
> > format you print to, or LaTeX might become confused about
> > the format of the figure.
> >
> > Rune
>
> Thanks for your reply!! I did what you told me to do but still I get an Error with: file 'plot.eps' not found and now I also get a warning: unknown graphics extension: .eps
>
> this is frustrating...

The lines below is what I use usually when dealing with eps files in LaTeX

\usepackage{graphicx}

    \begin{figure}[ht]
     \scalebox{0.6}{\includegraphics{Figs/LTI_time}}
    \end{figure}

Subject: matlab figure in latex

From: Doug Schwarz

Date: 21 Mar, 2010 02:50:09

Message: 6 of 8

In article <ho2vuf$pc0$1@fred.mathworks.com>,
 "Angela Brands" <angela_christina@hotmail.com> wrote:

[snip]

> Thanks for your reply!! I did what you told me to do but still I get an Error
> with: file 'plot.eps' not found and now I also get a warning: unknown
> graphics extension: .eps
>
> this is frustrating...

Are you using pdflatex? If so, you will want to use pdf files instead
of eps files.

--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.

Subject: matlab figure in latex

From: Bruno

Date: 12 May, 2011 16:58:05

Message: 7 of 8

The problem is that eps figures are not comaptible with PDF

when you comppile your program you should generate a DVI file and then convert it to PDF

Subject: matlab figure in latex

From: Oskar Vivero

Date: 12 May, 2011 17:19:04

Message: 8 of 8

"Angela Brands" <angela_christina@hotmail.com> wrote in message <ho2slf$8cd$1@fred.mathworks.com>...
> hi there,
>
> I want to include a matlab figure in a latex file...
>
> Let say I want the figure: plot(1:10)
> I've read that you can save this figure as an eps file using the command:
>
> print -deps plot
>
> So now I have a file called plot.eps
>
> Then I need to iclude the figure as follows:
>
> \documentclass{report}
> \usepackage{graphicx}
> \begin{document}
> \begin{figure}
> \centering
> \includegraphics{plot}
> \end{figure}
> This is a sample document.
> \end{document}
>
> but when I build it, I get an Error that says: file 'plot' not found
>
> How can I get this right?? Does anyone have an idea...???
>
> (I use TeXnicCenter and Miktex)
>
> I would really apreciate help!
>
> Thanks
>
> kind regards
> Angela
>
>
>
> I use TeXnicCenter and Miktex

If you are going to use .eps you must compile your .tex file with dvips. Also you need to change your preamble to this:

\usepackage[dvips]{graphicx}
\DeclareGraphicsExtensions{.eps}

Make sure the plot.eps file is in the same root directory as the .tex file you are using. In case it is not, you must declare the path to the eps directory. You can do this as follows:

\usepackage[dvips]{graphicx}
\graphicspath{{eps/}}
\DeclareGraphicsExtensions{.eps}

Then, your command

\includegraphics{plot} should work no problem.

Check out Wikipedia's LaTeX book for plenty of examples:

http://en.wikibooks.org/wiki/LaTeX

Hope this helps

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us