我不小心把自带函数改了
求一个正确的
函数路径是
MATLAB 2021a\Program
Files\Polyspace\R2021a\toolbox\matlab\graphics\color\gray.m
我的matlab里的 gray 是:
D:\MATLAB\toolbox\matlab\graphics\color\gray.m
gray.m:
function g = gray(m)
%GRAY Linear gray-scale color map
% GRAY(M) returns an M-by-3 matrix containing a gray-scale colormap.
% GRAY, by itself, is the same length as the current figure's
% colormap. If no figure exists, MATLAB uses the length of the
% default colormap.
%
% For example, to reset the colormap of the current figure:
%
% colormap(gray)
%
% See also HSV, HOT, COOL, BONE, COPPER, PINK, FLAG,
% COLORMAP, RGBPLOT.
% Copyright 1984-2015 The MathWorks, Inc.
if nargin < 1
f = get(groot,'CurrentFigure');
if isempty(f)
m = size(get(groot,'DefaultFigureColormap'),1);
else
m = size(f.Colormap,1);
end
end
g = (0:m-1)'/max(m-1,1);
g = [g g g];