Skip to main content
1-Visitor
January 20, 2020
Solved

Help with if loop with array

  • January 20, 2020
  • 3 replies
  • 1607 views

There's no error in the worksheet, but the answer is incorrect. How do i define in Mathcad so that it would read each scalar in the array instead of a whole. 

(Mathcad 15)

Best answer by AlanStevens

One way is as follows:

 

selection.JPG

3 replies

23-Emerald IV
January 20, 2020
Yes, no error message from mathcad. ..
And the answers are all correct...given the equations and formula.
BUT: what did you expect to get. What is your purpose?
Please explain.

Success!
Luc
19-Tanzanite
January 20, 2020

One way is as follows:

 

selection.JPG

25-Diamond I
January 20, 2020

Turning the calculation into a function and calling that function vectorized might be an option.
Furthermore you have to use the logical "or" operator to connect your two conditions.

You don't have to name the formal function  argument "class_id" as I did, you may name it simply "class" as well.

Furthermore you may consider making "Dp" a second function argument.

Werner_E_0-1579547658903.png

MC15 worksheet attached