How to apply a diff to histogram object?

조회 수: 2 (최근 30일)
fransec
fransec 2019년 5월 21일
댓글: Star Strider 2019년 5월 27일
Hi everybody,
I am trying to apply a difference to an histogram result, which is an object.
H=histogram(matrixvalues,bins);
dH=[0,diff(H)];
but the result is
Undefined function 'diff' for input arguments of type 'matlab.graphics.chart.primitive.Histogram'.
This is because, I think, the H output is an histogram object and not a double.
With the older function hist there are no problems because the output is a double, but with histogram I can not.
Any advices?
Thanks a lot

채택된 답변

Star Strider
Star Strider 2019년 5월 21일
I have no idea what you wwant.
Try this:
dH = diff(H.BinCounts);
To se all the available fields, do this:
histogramFields = get(H)
  댓글 수: 10
fransec
fransec 2019년 5월 27일
It works! Great!
The only (little) problem is that in this way I have to add one edge more (for example the egds vector is a 52-element long), in order to obtain a h.Values of the same length of that produced by older hist function. So my egds vector will start from negative value, for exampe.
Anyway, thanks!
Star Strider
Star Strider 2019년 5월 27일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by