|
Dear all,
I'm trying to find spatial correlations (using the matlab 'corrcoef' function) between a given variable and a given index. I've a set of satellite images of sea surface temperature (sst) from a geographical area and at different times of the year stored in a netcdf file, and I want to calculate the correlation of each pixel with a given index. I have stored the index as a 2D matrix index=[1 2 3 4 5 6 7 8 9 10 11 12...] (1 would be the value of 'index' at the first week, etc.). I'm trying to write a code in matlab that allows me to compare the first value of 'index' (moment one) with the sst value of each pixel of my first image, then the second value of 'index' with each pixel of my second image, and so on. So, at the end, I would be able to plot a figure showing the value of correlation of sst and 'index' at each pixel. So far I have managed to write this (a very poor code that it is not working...because something important is missing...):
nc=netcdf('sstall.nc','r');
ts1=index;
for i=1:size(nc{'SST'},3)
for j=1:size(nc{'SST'},2)
ts2=nc{'SST'}(:,j,i);
C=corrcoef(ts1,ts2);
end
end
close(nc)
I don't know how to relate each (j,i) point in my images with each k value of the index at each n moment. Any suggestions on this?
Thank you very much
juckou
|