I want to use a formula node to make my code smaller.
I'm comparing a sensor value and depending on the value i have 3 options.
At the moment i get the error that labview thinks my 'Else if ' is a variabel instead of a command.
am i doing something wrong? another option is to use a Case-structure but this code is allready in a case so i don't know if this could give trouble.
what about 2
Set output values to default values (aka last ELSE part) IF x < y THEN set values (aka first IF part) IF x > y THEN set other values (aka second IF part)
As this example:
Why don't you use a case structure?
And keep in mind the limited resolution of floats when comparing them…
Still Overkill with the CPU overhead why not: (VI attached in 2010 for compatility)
Bah - you edited after just before I posted Gerd - there was no Pic there before!
Or without any case structure (and without non-typedef'd enums 😉 😞
You just have to put the correct numbers into the array constant…
Elegant Gerd, Scalable (and I would have typdef'd If I was keeping myself) but much less readable and unable to add e.g. a String to the same array - then the BD starts to get messy again.
Waiting for Christian to post with 1 compare function using a complex number that makes even your look big and a Rube!
when you want to mix datatypes you go with an 1D array of cluster and unbundle instead of the 2nd IndexArray…
Waiting for Christian to post with 1 compare function using a complex number that makes even your look big and a Rube
My own idea:
Just one comparison… 😄
Yesterday I needed my eyes tested for failing to see a comma,
now I think I need sleep for failing to think of the ovbious!
(Still waiting for Christian's wizardry though. - I don't think your is a Rube but he has a horrible habit of making thing that look simple like that even more simple!)