Averaging minute data to hour data
Show older comments
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 Comment
Ameer Hamza
on 19 Mar 2020
No need to include the complete txt file in the question. I have deleted to make the question readable.
Accepted Answer
More Answers (1)
Ameer Hamza
on 19 Mar 2020
Edited: Ameer Hamza
on 19 Mar 2020
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 Comments
Moses Joseph
on 23 Mar 2020
Ameer Hamza
on 23 Mar 2020
I guess you are using a release older than R2019a. readmatrix was added in R2019a.
Categories
Find more on Tables 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!