How can I calculate ensemble average of 6 2D matrices with nanmean function?

2 vues (au cours des 30 derniers jours)
Szabó-Takács Beáta
Szabó-Takács Beáta le 4 Mai 2016
Dear All,
I have 6 2D matrices. Both of them have 10958 rows and 30471 columns. The rows are the time and the columns are the space. I would like to calculate the ensemble time average of these martices using with nanmean function. I tried the following way:
pr_h1=repmat(NaN, 10958);
pr_h=repmat(NaN,size(pr_loci_MPI_ESM_LR_CLM));
>> for j=1:10958
for i=1:30471
pr_h1(j)=[pr_loci_MPI_ESM_LR_CLM(j,i), pr_loci_CM5A(j,i), pr_loci_CNRM_ALADIN(j,i), pr_CNRM_CCLM(j,i), pr_loci_CNRM_CM5_RCA4(j,i), prM_loci_EC_EARTH_RACMO(j,i)];
pr_h(j,:)=nanmean(pr_h1(j));
end
end
but I got the error:
In an assignment A(:) = B, the number of elements in A and B must be the same.
I would appreciate if someone helped me!

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by