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.

 Akzeptierte Antwort

Alberto
Alberto am 29 Sep. 2014

1 Stimme

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 Kommentar

Jim
Jim am 29 Sep. 2014
Thanks. I did not read far enough into the min and max documentation.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Predictive Maintenance Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

Jim
am 29 Sep. 2014

Kommentiert:

Jim
am 29 Sep. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by