counting number of times a values appears in file
2 次查看(过去 30 天)
显示 更早的评论
i have a file with numbers like...
1
2
3
4
2
1
6
4
and so on...
i want to count how many times each number appears in above file.. how to do that??
0 个评论
回答(2 个)
Naama
2014-9-12
You can use hist (assuming that you import your data to the x vector):
[count, bin] = hist(x, min(x):max(x));
where count contains the frequency of the numbers in bin.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!