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.
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!

 채택된 답변

Steven Lord
Steven Lord 2021년 9월 9일

1 개 추천

Use the histogram function instead of histc.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Histograms에 대해 자세히 알아보기

제품

릴리스

R2021a

질문:

2021년 9월 9일

답변:

2021년 9월 9일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by