Histogram, axis are wrong

조회 수: 11 (최근 30일)
Andibadia
Andibadia 2019년 6월 25일
답변: tejas alva 2019년 6월 25일
I currently have a problem where I try to use the histogram function in MATLAB, and it puts the values in the X axis and the index of the vector in the y axis.
My vector is x=[0 0 0 651 240 175 180 196 231 327];
This is what I get when I use histogram(x):
sfs.jpg
As you see, the actual values are in the X axis, and the index of the vector on the y axis. How can I fix this?
Thank you very much

답변 (1개)

tejas alva
tejas alva 2019년 6월 25일
Hey,
It seems like the problem with the way you decleared it. It generates a row vector and not a coloumn one. Try,
x=[0;0;0;651;240;175;180;196;231;327];
histogram(x)
Or,
y = transpose(x)
histogram(y)
This sets the axis right! Hope this is what you were looking for!

카테고리

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

태그

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by