How do I correlate two tables with a different number of rows?

7 ビュー (過去 30 日間)
Madeline Daveney
Madeline Daveney 2020 年 6 月 16 日
回答済み: Divya Gaddipati 2020 年 6 月 25 日
Hi,
I have two tables that I am trying to correlate, but they have a different amount of rows, so matlab is not allowing me to correlate them.
Is there a way to curcumvent different row length in this situation?
Regards,
M
  2 件のコメント
Walter Roberson
Walter Roberson 2020 年 6 月 16 日
perhaps do an innerjoin() first ?
Madeline Daveney
Madeline Daveney 2020 年 6 月 17 日
編集済み: Madeline Daveney 2020 年 6 月 17 日
I think that I solved the problem by putting NaN to fill up cells in the table that didn't have enough rows. Then I specified 'rows' 'complete' so that matlab would only correlate the cells that actually had values.
Here's an example for anyone who needs help with a similar problem in the future:
[r, pV]=corr(FAs_all,ESS_all,'rows','complete')
Thanks for your suggestion anyway!

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

採用された回答

Divya Gaddipati
Divya Gaddipati 2020 年 6 月 25 日
You could also convert the table to a matrix and use interpolation on the smaller matrix to resize it to the larger matrix's size. Then use corrcoef or corr2 to calculate the correlation.
You could also refer to a similar questions already asked:
For more information on corr2 and corrcoef, refer to the following links:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by