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.
Question
I have a matrix-form data stored in a CSV file, and it looks like this,
I want to make this 6 * 6 matrix be a symmetric matrix, like this,
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!
La solution
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.