Calculate minutes average values
15 次查看(过去 30 天)
显示 更早的评论
Hi, everyone.
As attached is my observations data for 24 hours from different transmitter (PRN) . The data here are from 1/1/2014 to 31/1/2014 resulting in thousands of row. From this excel (refer attachment), I need to extract 1-minute and 5-min averages for VTEC, S4 and Sigma for each 31 days.
Therefore, later I can do plotting for the graph but currently stuck here finding shortcut to find averages with thousands of data. Does anyone have any ideas? Thank you in advanced.
From Excel:
Column A - Day Column B- Time Column C- GPS TOW (may ignore)
Column D- PRN
Column E- VTEC Column F- S4 Column G- Sigma
0 个评论
采纳的回答
Cris LaPierre
2021-1-5
I would import the spreadsheet as a table, then convert the day and time into a datetime, convert that to a timetable, and use the retime function to combine the data into 1 minute and 5 minute increments.
data = readtable("Book_Jan.xlsx");
% Convert DAY and TIME into durations
data.DAY = days(data.DAY);
data.TIME = days(data.TIME);
% Create a datetime
data.TimeStamp = datetime(2014,01,01) + data.DAY-1 + data.TIME;
data.TimeStamp.Format = "MM-dd-yy HH:mm";
% Convert the table to a timetable
dataTT = table2timetable(data,"RowTimes","TimeStamp");
% Use retime to average the data into 1 and 5 minute increments.
dataTT1min = retime(dataTT(:,["VTEC" "S4" "Sigma"]),"minutely","mean")
dataTT5min = retime(dataTT(:,["VTEC" "S4" "Sigma"]),"regular","mean","TimeStep",minutes(5))
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calendar 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!