% sets the colormap to grey, using the gray(___) command % and appends red=[1 0 0] to the end to represent NaN % % Example: greynan(200) % produces 200 greylevels, and 1 red level % % default is 128 levels (to leave some for other windows) function simplify_typing_long_commands_like_colormap_gray_128_or_the_like(M) % returns nothing if nargin<1 disp('greynan: setting colormap to default 128 grey levels + red, to make 129 total') M = 128; % default end%if if nargin == 1 if M<256 disp1=sprintf('greynan: setting colormap to %g grey levels ',M); disp2=sprintf('+ red to make %g levels total',M+1); disp([disp1 disp2]) else disp('greynan: -----------------------------------------------------------') disp1=sprintf(' | %g greylevels + red makes a %g long colormap ',... M,M+1); disp2='which is too long'; disp([disp1 disp2]) disp(' : -----------------------------------------------------------') return end%if end%if colormap(gray(M)) map = colormap; map = [map;[1 0 0]]; colormap(map)