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 CARSIM前车变道设置
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败