matlab 查看函数,如何查看MATLAB函数的源代码 | 学步园

如何查看MATLAB函数的源代码

大家都知道MATLAB是开源的,所有的函数源代码都是可以查看的。但是,对于初学者来说,可能还不知道如何查看MATLAB函数的源代码。

函数之  type

假设需要查看function_name的源代码,在命令窗口中键入 type  function_name

即:

>> type imread

function [X, map, alpha] = imread(varargin)

%IMREAD Read image from graphics file.

%   A = IMREAD(FILENAME,FMT) reads a grayscale or color image from the file

%   specified by the string FILENAME. If the file is not in the current

%   directory, or in a directory on the MATLAB path, specify the full

%   pathname.

%

%   The text string FMT specifies the format of the file by its standard

%   file extension. For example, specify 'gif' for Graphics Interchange

%   Format files. To see a list of supported formats, with their file

%   extensions, use the IMFORMATS function. If IMREAD cannot find a file

%   named FILENAME, it looks for a file named FILENAME.FMT.

%

%   The return value A is an array containing the image data. If the file

%   contains a grayscale image, A is an M-by-N array. If the file contains

%   a truecolor image, A is an M-by-N-by-3 array. For TIFF files containing

%   color images that use the CMYK color space, A is an M-by-N-by-4 array.

%   See TIFF in the Format-Specific Information section for more

%   information.

%

%   The class of A depends on the bits-per-sample of the image data,

%   rounded to the next byte boundary. For example, IMREAD returns 24-bit

%   color data as an array of uint8 data because the sample size for each

%   color component is 8 bits. See the Remarks section for a discussion of

%   bitdepths, and see the Format-Specific Information section for more

%   detail about supported bitdepths and sample sizes for a particular

%   format.

%

%   [X,MAP] = IMREAD(FILENAME,FMT) reads the indexed image in FILENAME into

%   X and its associated colormap into MAP. Colormap values in the image

%   file are automatically rescaled into the range [0,1].

%

%   [...] = IMREAD(FILENAME) attempts to infer the format of the file

%   from its content.

%

%   [...] = IMREAD(URL,...) reads the image from an Internet URL.

%

%   Remarks

%

%   Bitdepth is the number of bits used to represent each image pixel.

%   Bitdepth is calculated by multiplying the bits-per-sample with the

%   samples-per-pixel. Thus, a format that uses 8-bits for each color

%   component (or sample) and three samples per pixel has a bitdepth of 24.

%   Sometimes the sample size associated with a bitdepth can be ambiguous:

%   does a 48-bit bitdepth represent six 8-bit samples or three 16-bit

%   samples? The following format-specific sections provide sample size

%   information to avoid this ambiguity.

%

%   Format-Specific Information (Listed Alphabetically by Format)

%

%   BMP  --  Windows Bitmap

%

%   Supported  Compression     Output

%   Bitdepths  None    RLE     Class    Notes

%   ---------------------------------------------------------

%    1-bit      x        -     logical

%    4-bit      x        x     uint8

%    8-bit      x        x     uint8

%   16-bit      x        -     uint8    1 sample/pixel

%   24-bit      x        -     uint8    3 samples/pixel

%   32-bit      x        -     uint8    3 samples/pixel (1 byte padding)

%

%   CUR  -- Cursor File

%

%   Supported    Compression      Output

%   Bitdepths   None Compressed   Class

%   --------------------------------------------------

%   1-bit        x      -         logical

%   4-bit        x      -         uint8

%   8-bit        x      -         uint8

%

%   Special syntaxes:

%

%   [...] = IMREAD(...,IDX) reads in one image

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值