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 'if statement' for vector

NA_11204287
4-Participant

how to create 'if statement' for vector

Hi all, I've created a vector value as shown below 

NA_11204287_0-1726226271301.png

 

does anyone know how to create an 'if statement' to get the min/max results for these two vectors?

NA_11204287_1-1726226284485.png

 

Your help is kindly appreciated

ACCEPTED SOLUTION

Accepted Solutions

You don't need an if statement:

minmax.png

 

View solution in original post

5 REPLIES 5

You don't need an if statement:

minmax.png

 

this works for me. Thank you Alan! 

Werner_E
25-Diamond I
(To:NA_11204287)

Similar to my suggestion in your other thread (pass/fail) you could use vectorization

Werner_E_1-1726229791473.png

 

 

StuartBruff
23-Emerald III
(To:Werner_E)

I'm sorry, I couldn't help it.  I just had to generalize the problem.  What if I had more than two vectors, I thought, or even multiple arrays of differing lengths and column sizes?  Fortunately, this is an exercise in cat-skinning.  Here's one method that pays homage to my dislike of explicit iteration.  It's not totally functional because I thought such an approach would make the technique more obscure.

 

2024 09 13 A.png

 

And now the rubber of the functions meets the tarmac of the data ...

 

2024 09 13 B.png

 

Seems to work, as did a few nst2mat test cases using arrays of differing row and column sizes (see worksheet).

 

Stuart

NA_11204287
4-Participant
(To:Werner_E)

this also works fine for me. Thank you Werner!

Announcements

Top Tags