how to remove duplicates in correlations matrix

1 Ansicht (letzte 30 Tage)
kmla
kmla am 25 Sep. 2018
Beantwortet: dpb am 25 Sep. 2018
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]

Akzeptierte Antwort

dpb
dpb am 25 Sep. 2018
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?.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by