0

I have a matrix-form data stored in a CSV file, and it looks like this,

enter image description here

I want to make this 6 * 6 matrix be a symmetric matrix, like this,

enter image description here

How to use python (or matlab) to change an n by n matrix (square matrix) to a symmetric matrix? Or are there other tools can do this?

Please give me any suggestion, thank you!

Heinz
  • 2,415
  • 6
  • 26
  • 34

1 Answers1

1

In MATLAB, for an upper-triangular matrix A you can write

>> B = A' + triu(A,1)

where triu(A,1) extract the upper-triangular part without the diagonal - you do not want that to be doubled.

angainor
  • 11,760
  • 2
  • 36
  • 56