Skip to main content
1-Visitor
August 24, 2021
Solved

which of the solutions is right?

  • August 24, 2021
  • 3 replies
  • 1921 views

Hi,

 

I'm trying to find a variable and I've tried three ways of doing this. Please see attached.

I used an If statement and then put it in a program. Unfortunately, I can't see what is the difference among these 3 but I get different results. My preferred option is the program but I can't find why it is wrong..

 

Could you please check:)

 

thanks, 

Best answer by StuartBruff

Try the attached ...

3 replies

23-Emerald V
August 24, 2021

@EN_9902818 wrote:

Hi,

 

I'm trying to find a variable and I've tried three ways of doing this. Please see attached.

I used an If statement and then put it in a program. Unfortunately, I can't see what is the difference among these 3 but I get different results. My preferred option is the program but I can't find why it is wrong..

 

Could you please check:)

 

thanks, 


Your last option doesn't work because it returns the error message, and you've pre-added kPa in the evaluation operator units placeholder ... and strings don't take units.  I suggest that in cases such as Option 3, you put the units in the return expression.

 

Stuart

23-Emerald V
August 24, 2021

Try the attached ...

1-Visitor
August 24, 2021

Thank you very much!!!

23-Emerald I
August 24, 2021

Attached is a file that demonstrates the power and usefulness of vectorizing.

 

Method 1 is correct.

 

Method 2 is wrong because it carries the index (i) inside the program while it's still on V_Ed.red.  If you eliminate the index on that I believe Method 2 should work.  (With only Express, I an't try.)

 

Method 3 fails because the units on the text message don't match the units of the calculation.  (Texts don't have units.)

1-Visitor
August 24, 2021

Hi,

 

Thank you very much. This is very helpful.

 

Cheers,