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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Filtering a range variable

Gunjac
1-Newbie

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.

51 REPLIES 51

Upsssss...

It works now 🙂

Youve got some data at the top of the sheets youve posted.

They are enclosed in area.

Can you see them?

I hope its not something secret 🙂

MikeArmstrong
5-Regular Member
(To:Gunjac)

I left them included for you.

They are a collection of user defined functions which may be of use. I have them in my standard templates and occasionally use them. Might be worth reading through and identifying any you may have a use for.

MikeArmstrong
5-Regular Member
(To:Gunjac)

p.s. you defined a vector in your previous post. If this was a range you couldnt done multiplication based on statements, right?

For a better understand of how ranges, sequences and vectors work see the worksheets at the following path:

http://communities.ptc.com/docs/DOC-6073

Mike Armstrong wrote:

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.

The definition of Min() (locally or global) is necessary because the built-in functions min() and max() cannot be vectorized.

MikeArmstrong
5-Regular Member
(To:Werner_E)

Werner Exinger wrote:

The definition of Min() (locally or global) is necessary because the built-in functions min() and max() cannot be vectorized.

I suppose a range could have been passed to min() to achieve the same result?

I suppose a range could have been passed to min() to achieve the same result?

Horrible idea! Recently you posted yourself Stuarts papers about ranges vs. vectors a couple of times! Doubt that this would work anyway but unless I misunderstand what you mean it sure would be a misuse of ranges. There are only three situations where ranges should be used and this is none of them.

MikeArmstrong
5-Regular Member
(To:Werner_E)

Horrible idea yes, but an idea nevertheless.

I have just tried it and it does work, but I will not bother posting as I would not reccommend it.

Mike Armstrong wrote:

Horrible idea yes, but an idea nevertheless.

I have just tried it and it does work,

I doubt it! The result won't be a vector and that way be unuseable, I guess. Unless of course you are doiing something different from what you wrote (passing the ranges iteself ar arguments of min)

MIke can you please check your private messages.

Thank you.

MikeArmstrong
5-Regular Member
(To:Gunjac)

I will check now.

I suppose a whole re-write is necessary 😞

Would it be a problem fi I post some more questions on filtering variables couse Im already re-writing the program.

Thanx 🙂

MikeArmstrong
5-Regular Member
(To:Gunjac)

Mario Pende wrote:

I suppose a whole re-write is necessary 😞

Would it be a problem fi I post some more questions on filtering variables couse Im already re-writing the program.

Hi Mario,

Of course not. If you have specific problems within your project, break them down and post within the forum. If the issues differ from each other I would suggest putting them in different threads as it is much easier to follow.

Mike

MIke heres an file with description of a problem and what the solution should be.

MikeArmstrong
5-Regular Member
(To:Gunjac)

Unless I am missing something have we not solved this problem?

Both me and Werner have provided solutions above.

See attached for a silghtly improved version of my function.

But could MC create just one vector and not two for this filtering situation?

Youve created two vectors in your last post any chance for just one wich would recognize the angle condition and based on this procede to second statement?

MikeArmstrong
5-Regular Member
(To:Gunjac)

You mean spit a 2 column array out?

No, just one.

MikeArmstrong
5-Regular Member
(To:Gunjac)

I'm sorry I am not getting your point.

I shown 2 separate vectors to illustrate that the function works for the conditions you wanted. You do not have to show both vectors if you do not choose.

You can return the result from both conditions in an array if you wish.

I suggest you manually type the result you want to see and we can go from there.

My God, Im stupid 🙂

I see it.

I just need to erase the angle value in vector you defined and leave just alpha.

Sorry 🙂

Thanx a lot!

Heres another one wich would probbaly be used for many other situation that I could solve on my own later.

See file attached,

Before your response I started playing around with the function so it would accept multiple values for alpha and x, see attached for learning if of no use.

I see where your going.

Interesting! 🙂

Check you p.m.

Top Tags