# Correlation between two 2D arrays

I could not find anywhere, how to calculate correlation between two arrays. Say I do have Array1 with X and Y values and also Array2 with X and Y values. I tried to do some calculation and inserting two same arrays and expecting the correlation to be 1, but the result was something like -0.16...

I would be glad for any suggestion. Btw. I've found this Correlation coefficient between two arrays of 2D points? but still didnt find anything what could help me.

• To be clear, you want to compute the correlation between two matrices? Look into the RV coefficient, it is a multivariate extension of the R-squared. Commented May 11, 2016 at 15:36
• Wel, I have two arrays full of data like this. [0] => Array ( [x] => 964 [y] => 844 ). The arrays are same size. And now I would like to find programmatically correlation between this. Was googling for RV coefficient matlab examples, but did not find anything useful. Commented May 11, 2016 at 15:49
• I don't use MatLab, but you can do it in R using the coeffRV function in the FactoMineR package. Commented May 11, 2016 at 16:56