I know this is a popular problem. I have read that the matlab-prettifier package yields good results. My Editor told me, I am missing this package, though. I don't know how to download the package to ubuntu. Apparently, I have to do it manually.
Anyways, are there any other ways? I have tried the Matlab publishing option. It generates a code, which is more or less just a \begin{verbatim} ... \end{verbatim}
It is not in color.
matlab-prettifiercomes with most TeX distributions. You should be able to install it with whatever package manager you're using. If you post additional info about your system, we might be able to give you more guidance. – jub0bs Feb 24 '17 at 21:21