필터 지우기
필터 지우기

CREATE HISTOGRAMM WITH A SPECIFIC NUMBER OF CLUSTERS IN X AXIS

조회 수: 1 (최근 30일)
Ivan Mich
Ivan Mich 2020년 10월 27일
댓글: Sindar 2020년 10월 28일
Hello,
I have a question about a code. I would like to create a histogramm with a specific number of clusters. For example I would like to create 5 clusters and based on this to create a histogramm with my data. I am uploading an .xlsx file. In first column (x axis data) I have dates and in second column I have results/numbers (y axis data). I would like from the data in first column to grouped in 5 clusters and finally to create a Histogramm.
Could you help me?
Thank you in advance.

답변 (1개)

Sindar
Sindar 2020년 10월 27일
x = randn(1000,1);
nbins = 5;
h = histogram(x,nbins)
  댓글 수: 2
Ivan Mich
Ivan Mich 2020년 10월 28일
편집: Ivan Mich 2020년 10월 28일
ok, but the main problem is that I want specific values to be expressed via the histogram. I want a code:
1) Group my data in 1st column (5 clusters)
2) sum up for all the years my data in 2st column
3) make a histogram , ix axis my grouped data in first column, and in y axis the number of the sum of each group data (frequency I mean).
Could you help me ?
Thank you in advance
Sindar
Sindar 2020년 10월 28일
sounds like groupsummary is what you want. There's an example at that link for specifying grouping bins. It's easiest if your data is in a table (so, readtable from the xlsx file)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by