how can a make a loop in the z dimension (60 years) to get correlation coefficient values for a Grid (137 71) ?

1 visualización (últimos 30 días)
Hi,
I'm trying to get the correlation coefficient for each grid in a Matrix (137, 71) = (ny,nx) for 60 years (z dimension) considering an anomaly (Y) obtained for each grid and (137, 71, 60 years) and a another matrix (137, 71, 60 years) that contain an Index (X). The idea is to make the correlation along the years axis. I have tried this loop; however it gives me only NaN.
r = zeros(ny,nx);
for jj=1:ny for ii=1:nx for kk=1:ntime AnomWinter(jj,ii,kk) = WinterPp(jj,ii,kk)-Wintermean(jj,ii); r(jj,ii) = corr2(AOSON2(:,:,kk),AnomWinter(:,:,kk)); end end end
I have also tried this, but it gives me an error with the function
for jj=1:ny for ii=1:nx for kk=1:ntime AnomWinter(jj,ii,kk) = WinterPp(jj,ii,kk)-Wintermean(jj,ii); r(jj,ii) = corr2(AOSON2(jj,ii,:),AnomWinter(jj,ii,:)); end end end
how can a make a loop in the z dimension to get r values for the (137 71) matrix?...could you please help me...thanks,

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by