Effacer les filtres
Effacer les filtres

how to remove duplicates in correlations matrix

3 vues (au cours des 30 derniers jours)
kmla
kmla le 25 Sep 2018
Réponse apportée : dpb le 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]

Réponse acceptée

dpb
dpb le 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?.

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by