当代明月分享 http://blog.sciencenet.cn/u/chenfanglin

博文

一些经常要用到但又常忘的命令

已有 3758 次阅读 2009-3-14 10:53 |个人分类:Matlab|系统分类:科研笔记

 
好记忆不如烂笔头,坚持将自己遇到的经常要用到但又常忘的命令记下来,以防今后遇到相同问题而苦苦求索。

ind2rgb
Convert indexed image to RGB image
Syntax
RGB = ind2rgb(X,map)  %例如:[X, map]= imread(filename);
Description
RGB = ind2rgb(X,map) converts the matrix X and corresponding colormap map to RGB (truecolor) format.
ind2gray, rgb2gray, mat2gray, and so on.
 
meshgrid
Generate X and Y arrays for 3-D plots
Syntax
[X,Y] = meshgrid(x,y)
[X,Y] = meshgrid(x)
[X,Y,Z] = meshgrid(x,y,z)
Description


repmat
Replicate and tile array
Syntax
B = repmat(A,m,n)
B = repmat(A,[m n])
B = repmat(A,[m n p...])
Description
B = repmat(A,m,n) creates a large matrix B consisting of an m-by-n tiling of copies of A. The size of B is [size(A,1)*m, (size(A,2)*n]. The statement repmat(A,n) creates an n-by-n tiling.
B = repmat(A,[m n]) accomplishes the same result as repmat(A,m,n).
B = repmat(A,[m n p...]) produces a multidimensional array B composed of copies of A. The size of B is [size(A,1)*m, size(A,2)*n, size(A,3)*p, ...].


unique
Find unique elements of vector
Syntax
b = unique(A)
b = unique(A, 'rows')
[b, m, n] = unique(...)
[b, m, n] = unique(..., occurrence)
Description
 



https://blog.sciencenet.cn/blog-3199-220265.html

上一篇:错误“Failed to decrypt file”解决办法
下一篇:WinEdt自动换行设置
收藏 IP: .*| 热度|

0

发表评论 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-6-5 22:34

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部