Basic histogram with histogram function.

조회 수: 11 (최근 30일)
daniel caltrider
daniel caltrider 2020년 5월 14일
댓글: Ameer Hamza 2020년 5월 15일
I am trying to create a histogram from a data set in excel by importing it to matlab.
I can't get the histogram function to work with a table or data array after import.
I need to use the data set to make a histogram with a bin width of 50 and then subtract one entry per bin.
how do I reference the array or table in the histogram function? how would I subtract one entry per bin?
any help would be greatly appreciated.
  댓글 수: 3
daniel caltrider
daniel caltrider 2020년 5월 15일
I was able to figure out the histogram part by importing the intire .xlsx file with
[num,~,~]=xlsread('histogram2.xlsx');
d=num;
histogram(d,50)
histfit(d,50)
here is a small portion of the full data set:
1756
1055
4193
1156
7285
1095
845
3088
daniel caltrider
daniel caltrider 2020년 5월 15일
I still need help removing one entry per bin.

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

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 15일
편집: Ameer Hamza 2020년 5월 15일
To decrease, one entry per bin, try this
[num,~,~]=xlsread('histogram2.xlsx');
d=num;
h = histogram(d,50);
h.BinCounts = h.BinCounts-1
  댓글 수: 9
daniel caltrider
daniel caltrider 2020년 5월 15일
It worked! thank you!
Ameer Hamza
Ameer Hamza 2020년 5월 15일
I am glad to be of help!

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

추가 답변 (0개)

카테고리

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