problems using my custom color map
5 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
per isakson
2013 年 4 月 20 日
Is
set(gcf,'Colormap',mycmap)
executed in the base workspace?
5 件のコメント
Walter Roberson
2013 年 4 月 22 日
set(gcf, 'Colormap', evalin('base', 'mycmap'))
Are you familiar with the concept of MATLAB "workspaces" ?
その他の回答 (1 件)
Image Analyst
2013 年 4 月 20 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Colormaps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!