create a histogram from my data

조회 수: 8 (최근 30일)
mabdorab
mabdorab 2016년 12월 15일
댓글: mabdorab 2016년 12월 15일
x=[23948 25977 29136 33815 36435 40591 43243 44691 44805 45509 44830 45094 44236 43467 44189 45846 48375 48285 46372 44667 41938];
nbins=12;
h = histogram(x,nbins)
I am given the error message:
Error in histogram (line 4)
h = histogram(x,nbins)
why?
Also my data is years from 1995-2015 against different groups A, B, C, D , E.
The x values above were just values from my first column A against years.
Does anyone have any tips on creating histograms so I can predict a suitable distribution.

채택된 답변

Image Analyst
Image Analyst 2016년 12월 15일
histogram() is a built in function. But I can see from your error message "Error in histogram (line 4)" that you chose to name your script histogram.m. Not a good choice. Call your script something else, something that is not the name of a built-in function. You can use "which yourscriptName" to check if yourscriptName (or whatever you want to call it) is already a function.
  댓글 수: 1
mabdorab
mabdorab 2016년 12월 15일
yes thanks that explains it.

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

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2016년 12월 15일
which -all histogram
I'd guess you have another histogram command shadowing the MATLAB builtin one. Your command above works fine for me in 16b.

카테고리

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