comparing vectors for max and min

조회 수: 24 (최근 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 CenterFile Exchange에서 Motion 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