07-06-2010 10:28 AM
I have an Equal Comparison as a condition for a while loop. I probed the leads and they are equal however the output is false and the while loop continues to execute. I tried to typecast one wire to the other incase that was a problem(one being a numeric and the other a signed numeric) still not working. Please help?
Solved! Go to Solution.
07-06-2010 10:30 AM
The equal function will work as long as you don't do some silly thing like comparing floating point numbers. If you are, you should do a search for this extremely well discussed subject.
07-06-2010 10:38 AM
Do you have any screenshots or the VI that you can attach?
I have found the equal function to be very specific and even something like an extra space would cause it to not be equal (at least for strings). Make sure you are sure of what you are comparing. Is there a different way you could check for comparison?
07-06-2010 11:03 AM
06-03-2015 03:51 AM
@N8D11 wrote:
I have an Equal Comparison as a condition for a while loop. I probed the leads and they are equal however the output is false and the while loop continues to execute. I tried to typecast one wire to the other incase that was a problem(one being a numeric and the other a signed numeric) still not working. Please help?
I m facing a similar problem using comparison palette Greater than equal to and Equal to. Two same values when compared, the output is false. Please find the example vi attached and help!
06-03-2015 06:15 AM
06-03-2015 06:35 AM
There is no such thing as "Equals" when dealing with floating point numbers. The best you can do is an "approximately equal" by subtracting the two values and making sure the difference is less than whatever precision you want.
06-03-2015 09:56 AM
'subtracting the two values' --> don't forget to get the absolute of the difference before you compare to your tolerance limit... 😉
06-07-2015 12:13 AM
Thank You for your help. The precision and taking its absolute value solved my problem. 🙂 🙂
06-10-2015 09:44 AM
@QFang wrote:
'subtracting the two values' --> don't forget to get the absolute of the difference before you compare to your tolerance limit... 😉
Yup here is a made VI that is pretty much this.
https://lavag.org/files/file/259-floating-point-almost-equal/
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord