how to remove duplicates in correlations matrix

I have this matrix of correlation ;
'' 'A1' 'A2' 'A3' 'A4' 'A5' 'A6' 'A7'
'A1' [ 1] [ 0.9914] [ 0.9719] [-0.9996] [-0.9898] [ 0.9927] [ 0.9927]
'A2' [ 0.9914] [ 1] [ 0.9819] [-0.9924] [-0.9993] [ 0.9999] [ 0.9999]
'A3' [ 0.9719] [ 0.9819] [ 1] [-0.9691] [-0.9842] [ 0.9810] [ 0.9809]
'A4' [-0.9996] [-0.9924] [-0.9691] [ 1] [ 0.9902] [-0.9938] [-0.9939]
'A5' [-0.9898] [-0.9993] [-0.9842] [ 0.9902] [ 1] [-0.9988] [-0.9988]
'A6' [ 0.9927] [ 0.9999] [ 0.9810] [-0.9938] [-0.9988] [ 1] [ 1.0000]
'A7' [ 0.9927] [ 0.9999] [ 0.9809] [-0.9939] [-0.9988] [ 1.0000] [ 1]
I want to eliminte the redundant values to obtain a triangular matrix like this
'' 'A1' 'A2' 'A3' 'A4' 'A5' 'A6' 'A7'
'A1' [ 0] [ 0.9914] [ 0.9719] [-0.9996] [-0.9898] [ 0.9927] [ 0.9927]
'A2' [ 0] [ 0] [ 0.9819] [-0.9924] [-0.9993] [ 0.9999] [ 0.9999]
'A3' [ 0] [ 0] [ 0] [-0.9691] [-0.9842] [ 0.9810] [ 0.9809]
'A4' [ 0] [ 0] [ 0] [ 0] [ 0.9902] [-0.9938] [-0.9939]
'A5' [ 0] [ 0] [ 0] [ 0] [ 0] [-0.9988] [-0.9988]
'A6' [ 0] [ 0] [ 0] [ 0] [ 0] [ 0] [ 1.0000]
'A7' [ 0] [ 0] [ 0] [ 0] [ 0] [ 0] [ 0]

 採用された回答

dpb
dpb 2018 年 9 月 25 日

0 投票

x=triu(x,1);
Need to convert from N variables to an array to do this effectively. I'd guess that would be beneficial going forward overall besides just this one Q?.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeElementary Math についてさらに検索

質問済み:

2018 年 9 月 25 日

回答済み:

dpb
2018 年 9 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by