Calculating correlation matrix from time series in an array

I have a cell array with 164 entities, each with an entry of 193X1 time points. I need to create a correlation matrix of the dimension 164X164 with pearson correlations. How can I go about doing that?

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 9 月 21 日
編集済み: Ameer Hamza 2020 年 9 月 21 日

0 投票

Use corrcoef() but first convert the matrix to correct form
C = % 164 elements cell array
Cv = [C{:}]; % creating a matrix
coff_matrix = corrcoef(Cv); % 164x164 matrix

4 件のコメント

Native
Native 2020 年 9 月 21 日
Thanks, and if I have multiple arrays like that, and want to load them separately and run this code snippet for each of them and store separately, how do I do that?
Ameer Hamza
Ameer Hamza 2020 年 9 月 21 日
That depends how are they stored. Are they stored in .mat file? How to you want to store the output?
Native
Native 2020 年 9 月 21 日
編集済み: Native 2020 年 9 月 21 日
Yes they are stored as .mat files, I want to store the outputs separately as they were initially stored , just introduce the workspace variable of the correlation matrix.
Ameer Hamza
Ameer Hamza 2020 年 9 月 21 日
Without more information about the content of each mat file (i.e., names of variables) and how they are stored, it is difficult to give an exact solution.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMatrices and Arrays についてさらに検索

質問済み:

2020 年 9 月 21 日

コメント済み:

2020 年 9 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by