Averaging different initial conditions over 10 years
Show older comments
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!
1 Comment
KSSV
on 3 May 2023
Average of every 10th column or evry 10 colums?
Answers (1)
Mathieu NOE
on 3 May 2023
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
Lieve Denkers
on 8 May 2023
Mathieu NOE
on 12 May 2023
my pleasure !
would you mind accepting my answer ? tx
Mathieu NOE
on 28 Jun 2023
Hello
Problem solved ?
would you mind accepting my answer ? thanks !
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!