LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

create case structure using mutilple boolean conditions

Here, just modify the problem line in your formula node to this...

 

if(x>=100 && x<=200)

 

and delete all this...

 

if(x==100)

y=90;

 

elseif(x==200)

y=89;

 

As Yamaeda pointed out, you want every possible x to fit into a single if statement. Call your y function f(x) for now. Since f(100) = 90 and f(200) = 89, you just don't need those four lines to begin with.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

Message 11 of 13
(350 Views)

@Viper wrote:

@Yamaeda wrote:

Since you used a Double for X, i assumed you'd have values as 100.12. In that case, the case selectors option of 100..200 isn't really an option. 🙂 That only works for integers.


For your example I would multiply X by 100 then cast it to an I32. Then I would adjust my case selectors as well to account for the multiplication.

 

Norm


I have values for X with Double data type. Formula node is working now, I just need to remove the redundant if statements. Thanks for the help 🙂

0 Kudos
Message 12 of 13
(334 Views)

@Viper wrote:

@Yamaeda wrote:

Since you used a Double for X, i assumed you'd have values as 100.12. In that case, the case selectors option of 100..200 isn't really an option. 🙂 That only works for integers.


For your example I would multiply X by 100 then cast it to an I32. Then I would adjust my case selectors as well to account for the multiplication.

 

Norm


My comment was for OP, but your solution is good if you want it to 'work for 2 decimals', yes. 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 13 of 13
(317 Views)