replace maximum values of each row of a matrix
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Micangi
el 17 de Mzo. de 2021
Comentada: David Hill
el 22 de Mzo. de 2021
I have a huge matrix with i rows and j columns. I would like to find the max number for each row and, then, replace 1 in these positions and 0 in the other ones. For instance, I have matrix A
A = [1 4 3 0 ;6 0 5 9; 0 1 7 1 ; 1 5 3 1]
and I would like to produce matrix B.
B = [0 1 0 0 ;0 0 0 1; 0 0 1 0; 0 1 0 0]
I would like to have a code without using loops, as I am able to do it but the procedure time ts too long
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!