# MATLAB generated Tikz not working [closed]

When trying to use a .tikz file generated from a MATLAB script, the .tex file errors and is not able to build.

The .tex code is as follows:

\documentclass{article}

\usepackage{amsmath}
\numberwithin{figure}{section}

\usepackage{pgfplots}

\newlength\figureheight
\newlength\figurewidth

\begin{document}

\begin{figure}[h]
\setlength\figureheight{2cm}
\setlength\figurewidth{0.84\textwidth}
\input{IntroGraph.tikz}
\end{figure}

\end{document}


And the IntroGraph.tikz looks like:

\definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}
\begin{tikzpicture}

\begin{axis}[%
width=0.951\figurewidth,
height=\figureheight,
at={(0\figurewidth,0\figureheight)},
scale only axis,
xmin=0.5,
xmax=5.5,
xtick={1,2,3,4,5},
xticklabels={{\phi^1},{\phi^2},{\phi^3 = \phi^{Opt}},{\phi^4},{\phi^5}},
xlabel={Investment Options},
xmajorgrids,
ymin=1,
ymax=8,
ytick={1,2,3,4,5,6,7,8},
yticklabels={{0},{},{\mu^T\phi^5},{\mu^T\phi^4},{\mu^T\phi^1},{\mu^T\phi^2},{\mu^T\phi^3},{}},
ylabel={Portfolio Expected Return},
ymajorgrids,
axis background/.style={fill=white},
title style={font=\bfseries},
title={Returns of Investement Options}
]
plot [error bars/.cd, y dir = both, y explicit]
table[row sep=crcr, y error plus index=2, y error minus index=3]{%
1   5   1.7 3.7\\
2   6   1.5 1.5\\
3   7   0.3 0.5\\
4   4   2.3 1.2\\
5   3   4.9 0.7\\
};
\end{axis}
\end{tikzpicture}%


## closed as off-topic by user156344, Stefan Pinnow, Mensch, Raaja, TeXnicianMar 3 at 11:42

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• You have a lot of superscript ^ characters in there, outside math mode, it should read $\phi^1$ etc. I can't say why this occurs, however or if MatLab has a switch to ensure math mode for such stuff -- I don't have MatLab on my computer – user31729 May 25 '16 at 17:19
• Thanks a lot, essentially all my xticklabels had to placed in . Now it works fine. – Niccolo May 25 '16 at 17:22
• yticklabels as well ;-) – user31729 May 25 '16 at 17:23
• I'm voting to close this question as off-topic because it is already solved in comments. – user156344 Mar 3 at 9:17