# Problem including user-defined colormap in TikZ

I have a small problem with TikZ I can't figure out. I have some TikZ code generated in MATLAB (using matlab2tikz) showing an image with a user-defined colormap and the correspondent colorbar. The image is exported as .png but given that the colorbar is created in TikZ I need to color it accordingly (defining the new colormap). I simplified the code to get a MWE and it reads as follows (I replaced the user-defined colormap with a simple one):

\documentclass[11pt,twoside,a4paper]{article}
\usepackage{pgfplots}
\pgfplotsset{plot coordinates/math parser=false}
\usepackage{tikz}                       %inline graphics
\usetikzlibrary{plotmarks,external}
\begin{document}

\begin{tikzpicture}

\begin{axis}[width=\textwidth,height=4cm,axis on top,scale only axis,
xmin=0,xmax=5,xlabel={myxlabel},ymin=0,ymax=4000,
colorbar,
colormap ={mymap}{rgb(0pt)=(0,1,1); rgb(63pt)=(1,0,1)},
ylabel={myylabel}
]
\end{axis}
\end{tikzpicture}%
\end{document}


This works fine, but given that my colormap has more than two colors definitions, I thought that saving it in a separate .tex file, say mycmap.tex, was a nice idea

colormap ={mymap}{\input{mycmap}},


However, if I do this it doesn't work... I tried to save it as a .txt file instead of .tex, but still no luck. Any idea on how to fix it?