Finding array with maximum value at each row

7 visualizaciones (últimos 30 días)
sushma sharma
sushma sharma el 20 de Abr. de 2013
hi,
i have three 10 x 1 arrays, a, b, and c. how can i write a function that show which array has the highest value at each row. the output will be something like this: a c b b a .... any help would be appreciated! sushma

Respuesta aceptada

the cyclist
the cyclist el 20 de Abr. de 2013
>> [~,idx] = max([a,b,c],[],2)
idx will be 1,2, or 3, indicating whether a,b, or c has the max.
  2 comentarios
sushma sharma
sushma sharma el 20 de Abr. de 2013
thank you!
the cyclist
the cyclist el 20 de Abr. de 2013
Editada: the cyclist el 20 de Abr. de 2013
Since my answer solved your issue, please consider accepting it, for the benefit of those seeking similar solutions in the future.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by