MATLAB: Problems using the custom color map

colormap

Hi, I made a custom colormap (size = 15 x 3) and now I am trying to use it but it is not working. Here is the code:
…plotting code
set(gcf,'Colormap',mycmap)
And then I get this error:
Undefined function or variable 'mycmap'.
The mycmap variable is loaded into my workspace. Any help is appreciated.
Thanks, Dan.

Best Answer

Is
set(gcf,'Colormap',mycmap)
executed in the base workspace?