Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
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.
Solved! Go to Solution.
Perfect! 🙂
So the number in the brackets controls the limiting value and in the same time it names the new vector?
Second and improved version.
I have used the match function to find the indices in v which are greater than z.
Thanx one more time 🙂
No problem at all and welcome to the forum.
🙂
Careful! You run into problem if no element in v is greater than z as match will throws an error then. Use "onerror".
Werner Exinger wrote:
Careful! You run into problem if no element in v is greater than z as match will throws an error then. Use "onerror".
Well spotted.
Version 3 attached.
@Mike
can you see the file attach.
Same problem only I add variable alpha.
How to tell Mathcad that if aplha=90deg use same filtering but this time apply it to vector C.
@Werener
Can you post an egsample of what you ment.
Use my latest example with the 'onerror' function.
I have divided alpha by 'deg' as Mathcad will treat it a 0.524rad.
Have a look at the attached worksheet for an example of what Werner was refering to.
Without the 'onerror' function Mathcad returns the error message 'no matches found'. The 'onerror' function traps this and returns the comparison vector.
Ok but is there any way for my question from "Jun 18, 2014 3:09 AM"
How to tell Mathcad that if aplha=90deg use same filtering condition but this time apply it to vector C and not to vector B.
How about the attached?
I have augmented the data.
Is this what you want?
But none of your data will be filtered when alpha is 90deg - is this really what you want?
Ive explined it wrong.
Look at my file previously attached for vector D(10)
When alpha is not 90 deg then the D(10) vector should contain values 4,5,6,7,8,9,10,10,10,10,10- 11 values that are created filtering the B vector
When apha is 90 deg then D(10) vector should contain values 0,5,5,5,5,5,5,5,5,5,5 - 11 values that are created by filtering C vector
Yes that it! 🙂
1.)So you had to first create an augmented vector BC and then define conditions?
2.)Is there any possibility that you dont need to create the BC vector so that Mathcad uses only B and C vectors.
Ive tried something (see file attached) but it does following mistakes:
when alpha is not 90 deg it does the filtering on vector B and C so the result vector D(10) has 22 results instead of 11 results.
When alpha is 90 deg it only displays 2 results wich are correct but additional 9 are missing.
1.)So you had to first create an augmented vector BC and then define conditions?
2.)Is there any possibility that you dont need to create the BC vector so that Mathcad uses only B and C vectors.
Yes see attached. I must have had a moment when I suggested that.
Hats of to Mike Armstrong! 🙂
Mike can you explain a bit this programing lines, how they work and what every lines means.
I dont wanna ask you a question when something has to modified in the conditions.
Have a look in the attached. Hope it makes sense.
Damn, Ill have to read this few times.
Will report back 🙂
I will try and expand my explanation if you are struggling.
Here is a different approach. I would prefer making the vector(s) to be filtered and also the angle arguments of the filter function:
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.
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?
Like so?
I have used a user defined function (vec) to create a vector instead of the range variable which you used.
Mike you gotta tell me wich books youve been reading 🙂
Ive got 2 Mathcad books but NONE of them has these sort of things.
I tried adding some more conditions to your last post, wich would also include angle beta in terms but doenst work
Can you see file attached.
p.s. you defined a vector in your previous post. If this was a range you couldnt done multiplication based on statements, right?
Mario Pende wrote:
Mike you gotta tell me wich books youve been reading 🙂
Ive got 2 Mathcad books but NONE of them has these sort of things.
I have never really picked up a Mathcad book - most of what I have learnt has been through the forum.
Mario Pende wrote:
I tried adding some more conditions to your last post, wich would also include angle beta in terms but doenst work
Can you see file attached.
Have a look at my notes with the attached worksheet. You have duplicated the condition statements.