Borrar filtros
Borrar filtros

How to take hourly average from 15 minutes random data.

1 visualización (últimos 30 días)
varunesh
varunesh el 7 de Sept. de 2016
Comentada: varunesh el 7 de Sept. de 2016
I have 15 minutes time interval data but data is not continuous some time he gives 3 values in a hour and some time 2 values in a hour. So this is difficult for me make a code to convert this in a hourly data. I am also attaching time matrix, which is indicate the time for observing the data. Please help me. Thank you in advance.
  2 comentarios
Andrei Bobrov
Andrei Bobrov el 7 de Sept. de 2016
Sorry my Octave-4.0.3 don't open your file as so him made in MATLAB 5 - very old relise. Please attach your data in .xlsx or .txt file.
varunesh
varunesh el 7 de Sept. de 2016
Thanks, Okay, Please see attached file.

Iniciar sesión para comentar.

Respuestas (1)

Andrei Bobrov
Andrei Bobrov el 7 de Sept. de 2016
d = xlsread('data1.xlsx',1,'A2:B1147');
d0 = datevec(d(:,1) + datenum([1900 1 -1]));
[a,b,c] = unique(d0(:,1:4),'rows','first');
hourly_data = [a, accumarray(c,d(:,2),[],@mean)];
  1 comentario
varunesh
varunesh el 7 de Sept. de 2016
when I am running last line of this code then i got this error.
Index exceeds matrix dimensions.
did you saw time variable or not??
I mean this
Time
7/6/2016 15:30
7/6/2016 15:45
7/6/2016 16:00
7/6/2016 16:15
7/6/2016 16:30
7/6/2016 16:45
7/6/2016 17:00
7/6/2016 17:15

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by