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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

How do I limit the values in an array in matchad prime 10

LP_11025178
2-Explorer

How do I limit the values in an array in matchad prime 10

Hi, i don't speak english but

I want to limit the values in an array

MathCad Prime 10

LP_11025178_0-1719950595622.png

Please help me

4 REPLIES 4

I want to set the mín value to 4.5 m

ppal
17-Peridot
(To:LP_11025178)

I don't know if I understood what you are after.

 

But do you want ?

 

 

ppal_0-1719953581605.png

ppal_1-1719953607594.png

 

 

Hi @LP_11025178,

 

I wanted to follow up with you on your post to see if your question has been answered. 
If so, please mark the appropriate reply as the Accepted Solution. 
Of course, if you have more to share on your issue, please let the Community know so that we can continue to help you. 

 

Thanks,
Anurag
 

Werner_E
25-Diamond I
(To:LP_11025178)

The expression with the values shown in your screenshot can't be seen in the file your attached.

But using the "min" function should effectively limit the values so all values above 4.5 m are set to 4.5 m

Werner_E_0-1719955463584.png

 

EDIT: Ahh! I just read that you want 4.5 m to be the minimum value. So you should use the "max" function to set all values below 4.5 m to 4.5 m.
As with the values in your sheet all three results are below this threshold, all three are set up to 4.5 m.

Werner_E_1-1719955624686.png

 

Of course you also could use an if-statement

Werner_E_2-1719956053760.png

 

or also the if-function as suggested by ppal

Werner_E_3-1719956082299.png

The local variable "Result" was introduced as otherwise it would have been necessary to use the calculation expression twice, which I considered being harder to read and inefficient.

 

If you need to limit values more often, it might be an option to use a utility function limit(value,hi,lo) which does exactly what the name implies - the value returned will be in the range from lo to hi. This function could be hidden at the top of the sheet in a collapsed region or at the top to the right of the printable page.

It could be implemented using if-statements

Werner_E_4-1719956738984.png

or using the if-function

Werner_E_5-1719956769836.png

or using min and max functions

Werner_E_6-1719956796797.png

 

When you need to use it for a vector of values as in your sheet, you may either use a range variable k

Werner_E_7-1719956866556.png

or you call it vectorized

Werner_E_9-1719956902488.png

Announcements

Top Tags