ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean array

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?

0 Kudos
Message 1 of 9
(4,484 Views)

Hi john7,

see the "boolean array to number" function and check the result.

 

Mike

Message 2 of 9
(4,475 Views)

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.

0 Kudos
Message 3 of 9
(4,472 Views)

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.

 

 

Message 4 of 9
(4,465 Views)

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;)) 

Message 5 of 9
(4,460 Views)

Hi,

sorry for the confusion. Altenbach is absolutly right.

 

Mike

Message 6 of 9
(4,459 Views)

Hi John,

 

use Boolean to 0/1 and a ArraySum function...

 

Oops, shouldn't look at other websites in the mean time Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 9
(4,456 Views)

Thank you guys! Absolutelly perfect! Smiley Happy

0 Kudos
Message 8 of 9
(4,449 Views)

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.

Message 9 of 9
(4,443 Views)