# Matlabfrag figure in latex

I have been trying to figure out the best way to include vector plots from Matlab in Latex. I rounded on to matlabfrag, which is relatively straight forward compared to matlab2tikz.

Somehow, I am not even able to reproduce a basic example. I followed the matlabfrag example from here. In Matlab,

plot(1:10) ; title('help')
matlabfrag('fragtest')


foo.tex :

   \documentclass{article}
\usepackage{pstool}
\begin{document}
\psfragfig{fragtest}
\end{document}


Compiled with: pdflatex -shell-escape foo.tex. On compilation, I get a blank document with following message:

As suggested, I looked into the fragtest-pstool.log file and it contained the following errors:

! Illegal unit of measure (pt inserted).
e
l.22  \includegraphics [] {fragtest}

Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type 2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Illegal unit of measure (pt inserted).
e
l.22  \includegraphics [] {fragtest}

Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type 2' to delete
two letters. (See Chapter 27 of The TeXbook.)


I searched regarding this error with respect to psfragfig, but could not find any relevant solution. The similar problem is faced and report by someone here [in German]. But they do not mention the solution explicitly. Can someone help me on this? I spent the last two days completely on this issue.

The error is generated by matlabfrag-pstool.tex: Font sizes are given in exponential notation, which is not acceptable to LaTeX. The is the result of an error in the matlab code, which I have corrected and mailed to the author. [Matthias Pospiech, 10 Oct 2010]
Try to download the latest version of matlabfrag from https://github.com/zprime/matlabfrag (v0.7.0devb04 30-May-2013). At the other download sites that I found matlabfrag is older than the posting above, so doesn't contain the bug fix (if it was fixed indeed).
• True. Inside the tex file related with the eps file, there was line with \fontsize{1.320000e+01}{1.320000e+01}, which is an invalid Latex unit. Therefore, modifying the font size to an integer or latex valid unit solved the issue. – SKPS Dec 27 '16 at 15:48