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

    %% Display Image of Matrix Data
% Create matrix C. Display an image of the data in C. Add a colorbar to the
% graph to show the current colormap. By default, |imagesc| scales the
% color limits so that image uses the full range of the colormap, where the
% smallest value in |C| maps to the first color in the colormap and the
% largest value maps to the last color.

% Copyright 2015 The MathWorks, Inc.


C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
imagesc(C)
colorbar