Averaging minute data to hour data
显示 更早的评论
Greetings all.
My name is Joseph Moses.
I would like this great house to help me on how to average my data into hour and the hourly averaged data into daily.
For instance,
1.How do i get the corresponding average of 0.00:0.983, 1.000:1.983 till 23.00:23.983 in the second column (VTEC Data) from the below data or the attached.
2. Then plot the result Time against VTEC
1 个评论
Ameer Hamza
2020-3-19
No need to include the complete txt file in the question. I have deleted to make the question readable.
采纳的回答
更多回答(1 个)
Ameer Hamza
2020-3-19
编辑:Ameer Hamza
2020-3-19
Try this
M = readmatrix('bjcoo001-2015-01-01.txt');
time = t(:,1);
hours = floor(time);
hour_average = splitapply(@(x) mean(x(:, 2:end), 1), M, hours+1);
hour_average = [unique(hours) hour_average];
plot(hour_average(:,1), hour_average(:,2:4));
2 个评论
Moses Joseph
2020-3-23
Ameer Hamza
2020-3-23
I guess you are using a release older than R2019a. readmatrix was added in R2019a.
类别
在 帮助中心 和 File Exchange 中查找有关 Tables 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
