Visualize matrix by a heatmap
% PCOLORMAT allows you to visualize the matrix with color gradient
%
% USAGE:
%
% pcolorMat(mat,ncolor,ndigits)
%
% INPUT:
% - mat: The matrix you want to visualize
% - ncolor: number of color gradient
% - ndigits: number of decimal digits shown in the figure.
%
% OUTPUT:
%
% EXAMPLES:
% pcolorMat(rand(4,4))
% pcolorMat(rand(4,4),4)
%
% Copyright 2015. Zhang (Frank) Cheng (zhangc518@gmail.com
% v:1.0 22 May 2015. Initial release.
%
% Dependence:
% colorGradient.m: http://www.mathworks.com/matlabcentral/fileexchange/31524-colorgradient--generate-custom-linear-colormaps/content/colorGradient.m
Cite As
zhang (2026). Visualize matrix by a heatmap (https://www.mathworks.com/matlabcentral/fileexchange/50835-visualize-matrix-by-a-heatmap), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- AI and Statistics > Statistics and Machine Learning Toolbox > Descriptive Statistics and Visualization >
- MATLAB > Graphics > Labels and Styling > Color and Styling > Green >
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
