matlab之对元素出现的次数进行统计

可以使用hist函数:

A = [1 3 5 3 1 5 3 1 1 3 5];
count = hist(A,unique(A))

count的结果与unique(A)对应。
对于unique的介绍看这里.

你可能感兴趣的:(Matlab)