tally.m

来自「统计分析的软件包」· M 代码 · 共 12 行

M
12
字号
function out = tally(x);
%TALLY	TALLY(X) calculates the frequencies of the distinct levels of X.
%	Output is a matrix with two rows, the first containing the
%	levels of X and the second the corresponding counts.

%	GKS  27 Dec 1992

s=sort(x(:))';
[m n]=size(s);
i=find( [ 1 diff(s) ] > 0 );
out=[ s(i); diff([i n+1]) ];

⌨️ 快捷键说明

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