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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

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 !

1 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

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

Top Tags