Borrar filtros
Borrar filtros

Monthly average of daily time series

3 visualizaciones (últimos 30 días)
Agnete
Agnete el 17 de Nov. de 2013
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

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by