Skip to main content
1-Visitor
June 18, 2014
Solved

Filtering a range variable

  • June 18, 2014
  • 2 replies
  • 11445 views

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.

Best answer by MikeArmstrong

Something like the attached?

2 replies

1-Visitor
June 18, 2014

Something like the attached?

Gunjac1-VisitorAuthor
1-Visitor
June 18, 2014

Perfect! 🙂

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

1-Visitor
June 18, 2014

Second and improved version.

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

25-Diamond I
June 19, 2014

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

1-Visitor
June 19, 2014

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.

Gunjac1-VisitorAuthor
1-Visitor
June 19, 2014

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?