I'm sure I've done something silly, but I can't work out why my code isn't working. Hopefully a fresh pair of eyes will help.
I'm trying to perform a moving correlation by specifying the index locations within a matrix for the correlation to be performed on. This then cycles through the for loop to give me answers for my whole matrix.
BUT! It's not saving each value into my specified matrix, and my output (MIChinacorr) is just a NaN matrix.
I know that the corr code works, because when I manually say k=1, I get an answer.
What am I doing wrong?
Thanks for your help.