필터 지우기
필터 지우기

How can I average a matrix of 105108X6 constructed every 5 minutes measured data to 15 min?

조회 수: 1 (최근 30일)
Hello Matlab community,
I have a matrix (105108X6) of climate variables gathered every 5 minutes of one year, I wanna average this information every 15 minutes and store the info in a new matrix, how can I do that? I tried doing a loop like this:
dat_cal_15 = zeros(round(length(dat_cal)/3),1)
for i=1:round(length(dat_cal)/3)
for a = 3*((i-1)+1)-2
for b = 3*i
dat_cal(i,1)= round(mean(dat_cal(a:b)));
end
end
end
but is not working for all the columns....
thank you for your help

채택된 답변

KL
KL 2017년 12월 6일
편집: KL 2017년 12월 6일
I's suggest using a timetable.
Frist convert your matrix to timetable using array2timetable,
dat_cal_TT = array2timetable(X,'RowTimes',time_column_here)
and then use retime,
TT_15min_mean = retime(dat_cal_TT,min_15_time_vector,'mean')
create a time vector (min_15_time_vector) with your desired sample time.
  댓글 수: 4
Gina  Cabas
Gina Cabas 2017년 12월 6일
Thank KL for your help, I got what I needed, and then, to be able to use the new dataset and have again an array matrix with data, should I use timetable2table function?
KL
KL 2017년 12월 6일
I'm not sure what you mean but if you want to extract the values from the resulting timetable, you could probably use .Values property.
TT.Values

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by