필터 지우기
필터 지우기

how to remove duplicates in correlations matrix

조회 수: 3 (최근 30일)
kmla
kmla 2018년 9월 25일
답변: dpb 2018년 9월 25일
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일
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개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by