problems using my custom color map
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuesta aceptada
per isakson
el 20 de Abr. de 2013
Is
set(gcf,'Colormap',mycmap)
executed in the base workspace?
5 comentarios
Walter Roberson
el 22 de Abr. de 2013
set(gcf, 'Colormap', evalin('base', 'mycmap'))
Are you familiar with the concept of MATLAB "workspaces" ?
Más respuestas (1)
Image Analyst
el 20 de Abr. de 2013
You can try using the colormap() function instead. Does this work for you?
grayImage = imread('cameraman.tif');
image(grayImage);
mycmap = jet(15);
% set(gcf,'Colormap',mycmap)
colormap(mycmap);
colorbar
Apparently you did not specify mycmap like you thought. Put this line right before your call to set():
whos mycmap
If it says it's undefined, then it is undefined, not 15 by 3 like you thought.
0 comentarios
Ver también
Categorías
Más información sobre Colormaps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!