what function to use to find frequency of values in set?
Show older comments
How do I find number of occurence of a certain number in a set.
I have
R12= [5 6 1 2 6 1 2 1 2 6 5 2]
I need to find frequency of occurs of each number
Accepted Answer
More Answers (2)
William
on 23 Mar 2021
0 votes
... or maybe histcounts(R12) to get a histogram.
Image Analyst
on 23 Mar 2021
You could use histcounts:
R12= [5 6 1 2 6 1 2 1 2 6 5 2];
edges = [unique(R12), inf]
counts = histcounts(R12, edges)
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!