weixin_45913736 2022-05-13 11:41 采纳率: 100%
浏览 9
已结题

求Matlab 2021a版本系统自带的gray.m函数

我不小心把自带函数改了
求一个正确的
函数路径是
MATLAB 2021a\Program
Files\Polyspace\R2021a\toolbox\matlab\graphics\color\gray.m

  • 写回答

1条回答 默认 最新

  • 梦什 2022-05-13 12:29
    关注

    我的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];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录

报告相同问题?

问题事件

  • 系统已结题 5月21日
  • 已采纳回答 5月13日
  • 创建了问题 5月13日

悬赏问题

  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)