Extracting specific data from time range excel
6 次查看(过去 30 天)
显示 更早的评论
I have exported data from a sensor reading. It doesn't allow me to extract hourly data and that's what I really need. In the excel table, I have the device name, date and time (10 mins interval), the readings. I would like to know a faster way to filter out 1 data reading per hour (data is provided every 10 mins interval).
0 个评论
采纳的回答
Star Strider
2023-3-4
It would help to have the Excel file.
The ‘1 data raeading per hour’ request is open to intpretation.
Then, depending on what you want to do, you can either take a specific interval in every hour, or aggregate the data over every hour.
T1 = table(datetime(2023,03,01)+minutes(0:10:300).', randn(31,1), 'VariableNames',{'Timestamp','Sensor'})
EveryHour = T1(minute(T1{:,1})==0,:) % First Entry Every Hour
HourlyMean = table2timetable(T1);
HourlyMean = retime(HourlyMean, 'hourly','mean') % Mean Of Every Hour
A bit of clarification of what you want to do would help.
.
2 个评论
Star Strider
2023-3-4
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1314110/Data%20Sample.csv')
% TT1 = table2timetable(movevars(T1,4,'Before',1))
EveryHour = T1(minute(T1{:,4})==0,:)
No exact data exist for some time values, such as ‘00:00’ and ‘01:00’. They could be forced to exist using the approach in Interpolate Timetable Data to Time Vector, however that can create data where none previously existed, so I do not usuallly recommend it.
.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!