Averaging minute data to hour data
Mostrar comentarios más antiguos
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 comentario
Ameer Hamza
el 19 de Mzo. de 2020
No need to include the complete txt file in the question. I have deleted to make the question readable.
Respuesta aceptada
Más respuestas (1)
Ameer Hamza
el 19 de Mzo. de 2020
Editada: Ameer Hamza
el 19 de Mzo. de 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 comentarios
Moses Joseph
el 23 de Mzo. de 2020
Ameer Hamza
el 23 de Mzo. de 2020
I guess you are using a release older than R2019a. readmatrix was added in R2019a.
Categorías
Más información sobre Tables en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
