Find correlation coefficient of every nth row

2 次查看(过去 30 天)
I have two 121x14 matrices. I want to find the correlation coefficient of column 8 in each matrix. So I have made two matrices with only the data that I want to correlate. Using:
UVI_am = CP_ALL_W_am(:,8);
UVI_pm = CP_ALL_W_pm(:,8);
Now I want to correlate every 11 rows and save the correlation coefficient to different output array. I know you can correlate using:
R=corr(UVI_am,UVI_pm);
but how does one limit to every 11 rows and repeat it.

采纳的回答

Andrei Bobrov
Andrei Bobrov 2017-4-13
UVI_am = reshape(CP_ALL_W_am(:,8),11,[]);
UVI_pm = reshape(CP_ALL_W_pm(:,8),11,[]);
R = arrayfun(@(ii)corr(UVI_am(:,ii),UVI_pm(:,ii)),(1:11)');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by