How to Create a hystogram based on a timetable?

4 views (last 30 days)
Diego Dranuta
Diego Dranuta on 23 Mar 2021
Answered: Gargi Patil on 26 Mar 2021
Hi, I have a time table that contains data from 28 days from 3 engines.
I have group them and synchronized them but I am having issues to create an histogram showing hours of engine activity per day. Engine activity is showed by engine load. therefore something like if Engine1Load>0, then engine1 is on. This should be done for the 3 engines and duration should be extracted from Absolute time.
Table looks something like this
Absolute Time Engine1Load Engine2Load Engine3Load
2020-02-18 17:58:11 NaN 40 NaN
2020-02-18 17:58:12 NaN 40 45
2020-02-18 17:58:13 NaN 40 45
2020-02-19 19:20:00 NaN 40 45
2020-02-19 19:20:01 15 40 45
2020-02-19 19:20:02 30 40 NaN
and the histogram would be something like this, in this case this is seconds, I want to do it in hours
Any ideas?
Thanks

Answers (1)

Gargi Patil
Gargi Patil on 26 Mar 2021
You can create stacked graphs using bar graphs. You can refer to the following documentation for implementation details: https://www.mathworks.com/help/matlab/ref/bar.html#bthxce9
You can also refer to a similar question on stacked histograms that has been answered: https://www.mathworks.com/matlabcentral/answers/293124-how-to-stack-hist

Community Treasure Hunt

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

Start Hunting!

Translated by