Skip to main content
1-Visitor
October 15, 2016
Solved

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

  • October 15, 2016
  • 5 replies
  • 3895 views

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 !

Best answer by Werner_E

Use vectorization.

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

5 replies

Werner_E
Werner_E25-Diamond IAnswer
25-Diamond I
October 17, 2016

Use vectorization.

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

1-Visitor
October 17, 2016

Short, simple and clear . Thank you very much