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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

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

DrilonShabani
10-Marble

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