MATLAB: How to remove duplicates in correlations matrix

duplicate values

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]

Best Answer

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?.
Related Question