comparing vectors for max and min

20 ビュー (過去 30 日間)
Jim
Jim 2014 年 9 月 29 日
コメント済み: Jim 2014 年 9 月 29 日
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 件のコメント
Stephen23
Stephen23 2014 年 9 月 29 日
Did you try the documentation for min and max ?

サインインしてコメントする。

採用された回答

Alberto
Alberto 2014 年 9 月 29 日
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 件のコメント
Jim
Jim 2014 年 9 月 29 日
Thanks. I did not read far enough into the min and max documentation.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMotion Modeling and Coordinate Systems についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by