Converting hourly data to per shift data
1 view (last 30 days)
Show older comments
Hello,
I would highly appreciate help with the following example.
I have houtly data and I need to convert it to per shift data, where I have 4 shifts that start and end at specific hour:
Shift Start End
A 00:00 07:00
B 07:00 14:00
C 14:00 17:00
D 17:00 00:00
I would like to create a new table where I will see: Date / Shift / Value for the shift*
* the value for each shift is a sum of the respective hours which are included in each shift.
Attached you can find xlsx with sample data.
Thank you for your time!
2 Comments
Sudhakar Shinde
on 28 Sep 2020
%You could try:
data = readtable('Hourly2Shift.xlsx');
infmt = 'yyyy-MM - dd''T''HH:mm:ss.S'
%Shift A
starttime = datetime('2020-08 - 1T00:00:00.00', 'InputFormat', infmt);
endtime = datetime('2020-08 - 1T07:00:00.00', 'InputFormat', infmt)
selected = data(isbetween(data.Date, starttime, endtime), :)
Answers (0)
See Also
Categories
Find more on Time Series Events in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!