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!