Use of Correlation function( corr)

조회 수: 33 (최근 30일)
Abhivyakti
Abhivyakti 2012년 8월 21일
답변: Karan Singh 2025년 1월 6일
I am new to MATLAB.
I need to test correlation function on a data set in the form of a table(1x9757). When i input this into the correlation function, a new matrix if formes with size 9757x9757. But all the values in it are 'NaN' and in the workspace (where the size and minimum and maximum values of variables is mentioned), in the column of minimum and maximum value a message comes that says, 'Too many elements'.
Could anyone please help me with this. I am stuck on this from a very long time.
Thanks!
  댓글 수: 1
José-Luis
José-Luis 2012년 8월 21일
편집: José-Luis 2012년 8월 21일
Strange. If your matrix is 1 * 9757 , then there is no correlation to be calculated and the result of corr() should be one. Some data would help to understand the problem.
Cheers!

댓글을 달려면 로그인하십시오.

답변 (1개)

Karan Singh
Karan Singh 2025년 1월 6일
Hi Abhivyakti,
I know the question is past old however for any one wondering Jose is right. It should come to one
data = rand(1, 9757);
dataTable = array2table(data);
disp(dataTable(:, 1:5));
data1 data2 data3 data4 data5 _______ _______ _______ _______ _______ 0.10003 0.88021 0.78291 0.13145 0.85536
correlationMatrix = corr(dataTable{1, :}', dataTable{1, :}');
disp('Correlation coefficient:');
Correlation coefficient:
disp(correlationMatrix);
1

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by