I have a correlation matrix X of five elements (C1, C2, C3, C4, C5)
C1 C2 C3 C4 C5 C1 * 1 0 1 0 C2 1 * 0 0 1 C3 0 0 * 1 1 C4 1 0 1 * 0 C5 0 1 1 0 *
I want to use MatLab to move whole non-zero cells close to the diagonal, and the diagonal cells are "*".
For example, you may notice that the columns and rows are shifted in the next matrix, and the diagonal cells are “*”.
C1 C4 C2 C5 C3 C1 * 1 1 0 0 C4 1 * 0 0 1 C2 1 0 * 1 0 C5 0 0 1 * 1 C3 0 1 0 1 *
Because I want to do clustering, so I want all non-zero cells to move closer to the diagonal after the shift. This is an NP-hard problem.
Does anyone know what functions in MatLab can implement this?
source share