www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/RandomlyReorderColormapAndDisplayImageExample.m

    %% Randomly Reorder Colormap and Display Image
% Load the |clown| data set to get image |X| and its associated colormap,
% |map|. Display the image.
%%

% Copyright 2015 The MathWorks, Inc.

load clown
figure
image(X)
colormap(map)

%%
% Randomly reorder the colormap to get the new colormap, |newmap|. Display
% image |X| with the new colormap. 
[Y, newmap] = cmpermute(X,map);
colormap(newmap)