Divide histogram bins by time
이전 댓글 표시
Hello
So I have processed data and want to present it as frequency over time. I used datenum to get timevectors but I don't know how to chose the binwidth to encompass one month since month is irregular. The code below does plot it in time but I am not sure how the values like "737287" referes to a particular date. Dividing a year by 12 would also be sufficient as it is not very important which month it is but I have failed in this as well. The starting/end dates is not static either as more data will come.
Any help would me much appreciated.
Thank you in advance.
TimeNS = datenum(NotScaled(:,3), 'dd-mm-yyyy')
h1 = histogram(Time)
datetick('x','dd-mm-yyyy')
댓글 수: 1
Steven Lord
2021년 6월 23일
Can you show a small (say half a dozen to a dozen) lines of your data so we can see the format in which it is stored? Can you also explain, in the context of that small data set, what (roughly) you want the plot to look like? Having a concrete example may make it easier to know what functions to suggest.
답변 (2개)
Star Strider
2021년 6월 23일
0 개 추천
I am not certain what the data are, however a histogram may not be appropriate. Instead, counting the data between two dates or averaging them using a timetable and the retime function may do what you want.
Since you are using datenum and datetick, you may not have these functions. If so, there are alternate approaches, such as combining unique and accumarray that would work instead.
댓글 수: 1
Star Strider
2021년 6월 23일
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
카테고리
도움말 센터 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!