Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hi, i don't speak english but
I want to limit the values in an array
MathCad Prime 10
Please help me
I want to set the mín value to 4.5 m
I don't know if I understood what you are after.
But do you want ?
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
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
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.
Of course you also could use an if-statement
or also the if-function as suggested by ppal
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
or using the if-function
or using min and max functions
When you need to use it for a vector of values as in your sheet, you may either use a range variable k
or you call it vectorized