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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Exculde some values

YA_10963798
14-Alexandrite

Exculde some values

How can I exculde some values to get the function runing without affecting the results? 

I want to exulde the zeros.

It is on page 28 

YA_10963798_0-1727791534425.png

Thanks in advance 

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:Werner_E)

If you really prefer to rather modify the vector, replacing zeros by NaNs, you may do it like this:

Werner_E_0-1727803859782.png

 

Personally I would prefer using a more generic, versatile utility function

Werner_E_0-1727807256532.png

 

 

View solution in original post

10 REPLIES 10
StuartBruff
23-Emerald III
(To:YA_10963798)

Could you kindly post your "CPT Input gef.xlsx" workbook, please?  I tried substituting CPT Input, but that is throwing up errors trying to define each element of qcza and fs.

 

Stuart

YA_10963798
14-Alexandrite
(To:StuartBruff)

yes sure

Thank you 

StuartBruff
23-Emerald III
(To:YA_10963798)

Thank you.

Werner_E
25-Diamond I
(To:YA_10963798)

Why don't you just use "try... on error...." in the calculation of R ?

BTW, writing 100% has no effect, its just a multiplication by the number 1.

If you wan the result to be displayed as % value, you have to format the result accordingly.

StuartBruff
23-Emerald III
(To:YA_10963798)

The gef Excel workbook cleared up the initial errors..  There are quite a few further down the Mathcad worksheet, though.  More importantly, there are only 26 pages, so page 28 has gone walkabout.  I couldn't find an area in the Mathcad worksheet that looked like the above, either - although I might have missed it.   Can you check please check that the Mathcad worksheet you posted is the same one that has the problem? (I've sometimes been guilty of not saving a worksheet before posting it, so these things can happen)

 

Stuart

Werner_E
25-Diamond I
(To:YA_10963798)

Maybe this helps.

No need for a 28 page worksheet which takes long to load, takes long to finish calculating and does not contain the problematic region at all!

 

Better for future questions: Create a small(!!!) worksheet with dummy data which shows the very same error!

 

Werner_E_0-1727803361543.png

 

Werner_E
25-Diamond I
(To:Werner_E)

If you really prefer to rather modify the vector, replacing zeros by NaNs, you may do it like this:

Werner_E_0-1727803859782.png

 

Personally I would prefer using a more generic, versatile utility function

Werner_E_0-1727807256532.png

 

 

YA_10963798
14-Alexandrite
(To:Werner_E)

 

 

Thank u 

Werner_E
25-Diamond I
(To:YA_10963798)


@YA_10963798 wrote:

Hi Werner, 

I hope you are doing well. 

I have a question >> Is the (if) you used in your answer the same (if) in the programming dropdown list or it is kind of different? because I couldn't it write it 


No. its not the program if-statement but I rather used the if function.

Simply type "if(" and you will see that the letters "if" change from italic to to upright boldface, indicating that they are now labelled as 'Keyword' and  not as "Variable'.

The if-Function is very similar to the 'if" command ins spreadsheets like Excel.
For more complicated expressions its harder to read, but for simple ones I prefer it because it takes up less space than the if-statement.

The following two functions are equivalent and you can see the difference:

Werner_E_0-1728222509386.png

Werner_E_1-1728222517864.png

The first one has the additional advantage that is also works in the free Prime Express version.

In the second we could delete the vertical program indicators and now that function would work in Express, too. But I think it could not be created from scratch in Express.

Werner_E_2-1728222672805.png

 

You could also use

Werner_E_3-1728222963423.png

which works because 'return' quits the program and so the last line is only evaluated if x is not 0.

 

StuartBruff
23-Emerald III
(To:Werner_E)

Und siehe da, wenn die Nächte dunkler werden, naht die Saison der Katzenhäute.

 

If someone really wants to exclude values from a vector, ...

 

2024 10 06 G.png

 

I've been bitten before by forgetting that Mathcad's lookup function definition of "eq" means to "be within TOL".

 

I couldn't decide whether to use match's or trim's argument order, so when in doubt, opt for the most confusing.

 

Stuart

Announcements

Top Tags