Calculate minutes average values
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Cris LaPierre
le 5 Jan 2021
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))
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!