필터 지우기
필터 지우기

Monthly average of daily time series

조회 수: 3 (최근 30일)
Agnete
Agnete 2013년 11월 17일
I have a daily time series for 6 years. I would like to make a monthly average plot where each month is an average for all 6 years. How do I make this average?
Date are in an 2556x10 matrix with values for 2556 days x 10 stations. I have reordered the data in a 2556x3x10 matrix with year, month and value for 2556 days and 10 stations.
I have tried the following but this gives nanvalues even though I use NaN-mean mP = zeros(12,1); %preallocation F = zeros(1); %preallocation for m = 1:12; % monthly loop F = nanmean(B(find(B(:,2)==m))); % make monthly average mP(m) = F; end
I have also tried something like [unMonth,IDX] = unique(C(:,1:2),'rows');
Out = [unMonth zeros(size(unMonth,1),1)]; % Averaging for d = 1:size(unMonth,1) Out(d,end) = nanmean(C(IDX == d,end)); end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by