Make an Histogram with 24 bars
1 回表示 (過去 30 日間)
古いコメントを表示
I have a variable of duration and I want to get an histogram where each bar (24 in total, for each hour) contains the total messages recieved at the same hour
0 件のコメント
回答 (2 件)
Cris LaPierre
2021 年 10 月 19 日
Check out the documentation for histogram. You likely want to use one of these syntaxes.
0 件のコメント
Steven Lord
2021 年 10 月 19 日
The histogram function can operate on datetime and duration arrays. Here's an example using datetime; you should be able to adapt it to operate on a duration array.
midnight = datetime('today');
secondsPerDay = seconds(days(1));
s = seconds(randi(secondsPerDay, 1000, 1));
T = midnight + s;
T(1:10) % Show the first few elements of T to show they contain date and time information
histogram(T, midnight + hours(0:24)) % 1 hour long bins
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!