help with max function

14 visualizaciones (últimos 30 días)
Marco Nashaat
Marco Nashaat el 10 de Feb. de 2020
Comentada: the cyclist el 29 de Oct. de 2020
[Max,index]=max(array,[ ],2)..... Iam using this syntax to find the maximum value of every column but in case of two equal maximum values it returns the first one... how can I solve this?! Thanks
  5 comentarios
Mohymen Kushal
Mohymen Kushal el 26 de Oct. de 2020
if A is a matrix, then max(A,[ ],2) is a column vector containing the maximum value of each row . What is this '2' for ? can anybody explain please. Thanks.
the cyclist
the cyclist el 29 de Oct. de 2020
As clearly stated in the documentation for max, that "2" indicates the matrix dimension along which to take the maximum.

Iniciar sesión para comentar.

Respuesta aceptada

the cyclist
the cyclist el 10 de Feb. de 2020
This code will return the row and column indices where the entry is equal to the column's maximum.
[rowIdx,colIdx] = find(A==max(A))

Más respuestas (0)

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by