editcolormapscript.m

来自「Continuous Profile Models (CPM) Matlab T」· M 代码 · 共 54 行

M
54
字号
%% Need to have java enabled on this Matlab session,%% i.e. cannot use -nojava (or possibly -nodesktop)%% set colormap back to defaultcolormap('default');%% open the colormap editorcolormapeditor;%% make up some name for this colormap%% eg. greenToWhiteToRedthisName = 'test';%thisName = 'greenToWhiteToRed';%thisName = 'whiteToRed4';%thisName = 'whiteToGreen4';%% set this variable name equal to the colormapcmd = [thisName '= colormap;'];eval(cmd);%% save this variable it to my colormap directorymyDir = '/u/jenn/matlab/colormaps/';cmd = ['save ' myDir thisName '.mat ' thisName ';'];eval(cmd);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% USAGE AFTERWARDS:%%%% to retrieve this colormap, use the following commands, using%% for example, the map called 'greenToWhiteToRed'%% or just say:% thisMap = 'greenToWhiteToRed';%thisMap = 'whiteToRed4'%thisMap ='whiteToGreen4';useMyColorMap(thisMap);%% see if it is what you expect;colormapeditor;%% OR, if want more than one%strList = {'greenToWhiteToRed'};strList = {'test','greenToWhiteToRed'};clmaps = getColorMaps(strList);%% now set the colormap to one of theseclMap = clmaps{1};colormap(clMap);%% see if it is what you expect;colormapeditor;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?