Hi, nice function.
There seems to be a problem though with the labeling. In case of a small input-matrix (i.e. 5x5), one has to set "ShowAllTicks=1" otherwise the function will give an error when you also provide labels:
Subscript indices must either be real positive integers or logicals.
Error in heatmap2>setAxesLabels (line 280)
Error in heatmap2 (line 111)
[p, xlab, ylab, hXText] = setAxesLabels(p, xlab, ylab);
try it :)