Averaging different initial conditions over 10 years

Hi,
I have a dataset with modeled windspeed data over blocks of 10 years (ervery year is a seperate column) and this has been modeled with 160 different initial conditions. Resulting in a 365x1600 array. so the culumns are year 1,2..10,1,2...10 with the different conditions after each other.
Now for further processing the data i would like to use a 365x10 array where every column is the average of a years. So basicly I want to take the average of every 10th column. But im not sure how to get this, anyone?
thx!

Answers (1)

nothing fancy here , but it does the job....
% create some dummy data
ic = 160;
years = 10;
data = rand(365,ic*years);
% main code
for ci = 1:years
cols = (1: years : ic*years) +(ci-1);
out(:,ci) = mean(data(:,cols),2);
end

3 Comments

my pleasure !
would you mind accepting my answer ? tx
Hello
Problem solved ?
would you mind accepting my answer ? thanks !

Sign in to comment.

Asked:

on 3 May 2023

Commented:

on 28 Jun 2023

Community Treasure Hunt

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

Start Hunting!