统计数值型数组中各元素出现的频数、频率。
例子1:
- >> x = [2 2 6 5 2 3 2 4 3 4 3 4 4 4 4 2 2
- 6 0 4 7 2 5 8 3 1 3 2 5 3 6 2 3 5
- 4 3 1 4 2 2 2 3 1 5 2 6 3 4 1 2 5];
- >> tabulate(x(:))
- Value Count Percent
- 0 1 1.96%
- 1 4 7.84%
- 2 14 27.45%
- 3 10 19.61%
- 4 10 19.61%
- 5 6 11.76%
- 6 4 7.84%
- 7 1 1.96%
- 8 1 1.96%
例子2:
a=[1 2 3 3 3 6 2]
K>> tabulate(a)
Value Count Percent
1 1 14.29%
2 2 28.57%
3 3 42.86%
4 0 0.00%
5 0 0.00%
6 1 14.29%