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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Translate the entire conversation x

If Else Error - The value must be scalar

JL_9921856
2-Explorer

If Else Error - The value must be scalar

In PTC Mathcad Prime 10.0.0.0 I am using an if else statement where I am comparing two variables, qu and qt with the same units, psf. However, I am getting the error that the value must be scalar. I am trying to get a return of qu or qt depending on what their values are. I would appreciate help in a solution for this.

 

JL_9921856_0-1751472967235.png

 

 

 

 

 

 

ACCEPTED SOLUTION

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

When you defined "qu" you had type square brackets. In Prime doing so creates a matrix and so "qu" ended up being a 1x1 matrix and Prime refuses to compare a matrix (even if its just 1x1) with a scalar.

Solution is to replace the square brackets by normal parentheses. 

Werner_E_0-1751473709039.png

 

BTW, the "min" function could be used here to achieve the very same result

Werner_E_1-1751473930796.png

 

 

View solution in original post

2 REPLIES 2
Werner_E
25-Diamond I
(To:JL_9921856)

When you defined "qu" you had type square brackets. In Prime doing so creates a matrix and so "qu" ended up being a 1x1 matrix and Prime refuses to compare a matrix (even if its just 1x1) with a scalar.

Solution is to replace the square brackets by normal parentheses. 

Werner_E_0-1751473709039.png

 

BTW, the "min" function could be used here to achieve the very same result

Werner_E_1-1751473930796.png

 

 

Werner, this solved the problem. I appreciate your input, I don't use Mathcad often so I am prone to these types of mistakes. Thank you. 

Announcements


Top Tags