sorting matrix by diagonal of submatrix
Afficher commentaires plus anciens
Hi,
I have a matrix of m x m^2 and I want to find the diagonals of the sub matrices m x m, then rearrange the matrix A such that the sub matrix with the largest diagonal is first and the sub matrix with the lowest diagonal is last
E.g. For the matrix A = [A1 A2 A3]
A =
2 4 6 8 9 1 4 8 1
4 1 2 3 6 1 2 3 4
5 2 3 4 1 7 2 3 12
Sub matrix A1 has a diagnoal of 6 Sub matrix A2 has a diagonal of 21 Sub matrix A3 has a diagonal of 19
so the final output would be A = [A2 A3 A1]
A =
8 9 1 4 8 1 2 4 6
3 6 1 2 3 4 4 1 2
4 1 7 2 3 12 5 2 3
Thanks in advance
1 commentaire
Cedric
le 29 Juin 2014
By largest diagonal you mean largest trace?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Operating on Diagonal Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!