expandd.m

来自「模式识别工具箱,本人毕业论文时用到的,希望对大家有用!」· M 代码 · 共 26 行

M
26
字号
%EXPANDD Expand integer vector to matrix occurance table% % 	A = expandd(x,m)% % The vector x containing just integers > 0 (e.g. numeric labels % obtained from renumlab) is expanded to a matrix A with size % (length(x),m) such that A(i,j) = 1 if x(i) = j and A(i,j) = 0 if % x(i) = j.% % As a result sum(A) is a frequency table of j in x. max(A) is a 0-1 % vector indicating the occurance of some j in x. find(max(A)) gives % all j that occur in x.% % See also renumlab% Copyright: R.P.W. Duin, duin@ph.tn.tudelft.nl% Faculty of Applied Physics, Delft University of Technology% P.O. Box 5046, 2600 GA Delft, The Netherlandsfunction a = expandd(x,m)x = x(:);n = length(x);if nargin == 1, m = max(x); enda = (x(:,ones(1,m)) == ones(n,1) * linspace(1,m,m));return

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?