I need Matlab code, e.g. the one here, in LaTeX and in colour (the comment is green, for/if/else/end is blue).
% super cooles Programm
i = 1
for i = 1:10
if i > 3
i=i+2
else
i=i+1
end
end
I tried
`\begin{lstlisting}
code
\end{lstlisting}`
this gave me the code, but not in colour.
I tried
\lstinputlisting[language=Matlab, frame=single]{\MatlabCodeToLaTeX.m}
this gave me the error message, that LaTeX couldn't start the file.
How do I get the code properly colored?
Best Answer
I adapted the example form TEX
output:
PS: next time when there is a latex question try searching TEX first!