How to do correlation between each row of two matrices?
Show older comments
I'm trying to calculation the correlation between each individual value in each row to the corresponding row in another matrix.
I have two matrices; both same size 442x1, 442x1.
I used the following code:
DR_all_stv = 442x1 matrix
Participation_Coeff = 442x1 matrix
stv_correlation = (corr(DR_all_stv(1:442,:),Participation_Coeff(1:442,:),'all',')');
However the corresponding code just gives me one correlation value, but I want to create an array that contains a value for each correlation between each row. It should be a 1 to 1 correlation.
Does anyone have any adivce on how I can calculate each correlation between the two corresponding rows?
1 Comment
Ameer Hamza
on 28 May 2020
Rows of DR_all_stv and Participation_Coeff have only one element. How do you want to calculate corr() between two scalars? Correlation is defined for multiple data points.
Accepted Answer
More Answers (0)
Categories
Find more on Descriptive Statistics and Insights in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!