How to take hourly average from 15 minutes random data.
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Andrei Bobrov
2016년 9월 7일
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.
답변 (1개)
Andrei Bobrov
2016년 9월 7일
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)];
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!