cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.

How to create a vector with the minimum values of two other vectors?

DrilonShabani
8-Gravel

How to create a vector with the minimum values of two other vectors?

If I have a vector A and B both with 10 elements. How can i create a vector  C that has the minimum values of A or B on each corresponding position.

Thanks in advance !

ACCEPTED SOLUTION

Accepted Solutions

Use vectorization.

But as min can't be vectorized, we have to write our own min function, calling the built in min.

View solution in original post

5 REPLIES 5

Use vectorization.

But as min can't be vectorized, we have to write our own min function, calling the built in min.

Short, simple and clear . Thank you very much

LucMeekes
23-Emerald III
(To:Werner_E)

Is there any good reason why min (and max, and mean and stdev) can't be vectorized?

I think all the above answers for the xxx1, 2 and 3 functions are OK, so they could (should!) have been produced by vectorizing the original function immediately.

Luc

Werner_E
25-Diamond I
(To:LucMeekes)

I, too, can't think of any good reason why min and max should not allow vectorization.

LucMeekes
23-Emerald III
(To:Werner_E)

I see you've given that a thorough thought. 🙂

Luc

Announcements

Top Tags