Histogram occurences per age problem
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nina Perf
le 9 Sep 2021
Réponse apportée : Steven Lord
le 9 Sep 2021
Hello,
I have a table with persons data. I have the ages in one column and I wanted to do an histogram like the one bellow.
How do I make the categories of age (11-20) , (21-30) and how can I plot them in the x axis, having the y axis as occurences.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/733819/image.png)
Right now I have the following:
figure()
[~,ii] = histc(Data.Age(1:16),[0:10:30,inf]);
out = accumarray(ii(:),14), xlabel('Age'), ylabel('Occurrences')
It doesn't work, can you please help?
Thank you in advance!
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Histograms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!