Compare two matrices and select max one based on the a column
Mostrar comentarios más antiguos
I have two matrixes and I want to compare the last column. Then select the max one and the whole corresponding row.
For example
A = [ 1 , 4, 5; 1, 4, 6];
B = [2, 6, 6; 2, 5 , 9];
The next matrix based on the last column max will be
C = [2, 6, 6; 2, 5 , 9];
Anyway to help, please
Respuesta aceptada
Más respuestas (1)
madhan ravi
el 17 de Mzo. de 2020
C = max(A,B)
3 comentarios
Yaser Khojah
el 17 de Mzo. de 2020
Editada: Yaser Khojah
el 17 de Mzo. de 2020
madhan ravi
el 17 de Mzo. de 2020
Illustrate the answer if the B were to be
B = [2, 6, 4; 2, 5 , 9];
Yaser Khojah
el 17 de Mzo. de 2020
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!