Skip to main content
1-Visitor
Solved

Filtering a range variable

Helo folks!

Please see the attached file.

How can I filter the range variable or vector so that it basicly creates a new one but for values greater then, let say 9 (like in the file attached) it returns 9 for all remaining values in the range.

Please help.

Thank you.

1-Visitor

Something like the attached?

52 replies

1-Visitor

Something like the attached?

Translate
Gunjac1-VisitorAuthor
1-Visitor

Perfect! 🙂

So the number in the brackets controls the limiting value and in the same time it names the new vector?

Translate
1-Visitor

Second and improved version.

I have used the match function to find the indices in v which are greater than z.

Translate
Werner_E
25-Diamond I

Here is a different approach. I would prefer making the vector(s) to be filtered and also the angle arguments of the filter function:

1.png

19.06.png

Translate
1-Visitor

Very nice Werner

So basically you have defined Min(x,y) as a function which allows each element of V to be looped through using Vectorize? I totoally forgot about this feature.

Translate
Gunjac1-VisitorAuthor
1-Visitor

This ones more complicated

See file attached.

A vector is defined with values from 0-15.

How to eg. multiply values in this vector, from 0-5 with an value A (defined previously), from 6-10 with value B, and from 11-15 with value C.

A new vector would be created, again with 15 values that were created by applying different conditions within the original vector.

Could this be done?

Translate