user2806363
user2806363

Reputation: 2593

How to compute correlation between columns of matrix A with columns of matrix B?

Given two matrices A and B, How can I compute correlation between columns of A with columns of B in matlab? corr() function support the vector form, but not matrices.

Upvotes: 0

Views: 98

Answers (1)

may be you want corr2 or you can use

A = randn(5,3);

B = randn(5,3);

C =corrcoef([A B], 'rows','complete'); 

C=C(size(A,1)+1:end,1:size(A,2)+1)

Upvotes: 2

Related Questions