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.
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!