MATLAB Answers

Sagar
0

How to calculate correlation coefficient between two 3-d matrices?

Asked by Sagar
on 23 May 2014
Latest activity Commented on by Sagar
on 10 Oct 2017
This is often required in analyzing climate data from netcdf files. Climate variables are stored in 3-d matrix (lat, lon, time). I want to find correlation coefficient between two 3-d matrices at each grid cell (i.e. correlation along time or 3rd dimension). Is there an easier way to do this, without reshaping, for geometric intuition of the grid map? Also how to get the p-value at each grid cell after calculating the correlation?

  0 Comments

Sign in to comment.

2 Answers

Answer by Adapa Bhagyaraja on 10 Aug 2015

Hello Sagar, There is a question similar to this. Check answer at http://in.mathworks.com/matlabcentral/answers/15884-correlation-for-multi-dimensional-arrays

  0 Comments

Sign in to comment.


Answer by André Gadêlha on 10 Oct 2017

Hi, Sagar.
Did you understand? I have got the same problem with netcdf analysis. How can I do it?
Best Regards,

  1 Comment

There is no way to do it directly. You must reshape the matrix and convert to vectors. After that you can calculate correlations in a loop.

Sign in to comment.