comparing vectors for max and min

12 visualizaciones (últimos 30 días)
Jim
Jim el 29 de Sept. de 2014
Comentada: Jim el 29 de Sept. de 2014
I am comparing two numerical vectors a and b. I want to create two new vectors-one is the element by element minimum of a(i) and b(i). The other has the maximums. are there functions that do this? The vectors are the same length.
  1 comentario
Stephen23
Stephen23 el 29 de Sept. de 2014
Did you try the documentation for min and max ?

Iniciar sesión para comentar.

Respuesta aceptada

Alberto
Alberto el 29 de Sept. de 2014
Functions max and min do the trick:
a=randi(9,1,10)
b=randi(9,1,10)
vect_max = max(a,b)
vect_min = min(a,b)
  1 comentario
Jim
Jim el 29 de Sept. de 2014
Thanks. I did not read far enough into the min and max documentation.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Predictive Maintenance Toolbox 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!

Translated by