11-23-2011 12:36 AM
Hi All!
I have boolean array. I need to chek if more than one element of array is true, if so it's faul state. How can i do it?
11-23-2011 01:41 AM
Hi john7,
see the "boolean array to number" function and check the result.
Mike
11-23-2011 01:48 AM
Hi MikeS81! If i use boolean array to number wich number indicates two bits set high? I should go and scan all cases. It's not so elegant especially if array is varying in size.
11-23-2011 02:15 AM
Use "boolean to 0,1" (it also works for boolean arrays) followed by "add array elements". If the resulting sum is >1, you have a fault.
11-23-2011 02:25 AM
Hi,
Check the attached vi. I have used a conditional for loop. (not sure if it is the best solution)
Regards,
Nitz
(Give kudos to good Answers, Mark it as a Solution if your problem is Solved;))
11-23-2011 02:26 AM
Hi,
sorry for the confusion. Altenbach is absolutly right.
Mike
11-23-2011 02:30 AM - edited 11-23-2011 02:31 AM
Hi John,
use Boolean to 0/1 and a ArraySum function...
Oops, shouldn't look at other websites in the mean time
11-23-2011 03:04 AM
Thank you guys! Absolutelly perfect!
11-23-2011 03:06 AM
Also, if you expect the possibility that the boolean array is larger that 2^15 (32k), you need to convert the output of boolean to 0,1 to I32 before taking the sum.