From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to build an Boolean array?

Solved!
Go to solution

I've a Boolean in a while loop which is alternating "true, false, true, false… ". How can write them into an Array like "1, 0, 1, 0…"? Thanks.

0 Kudos
Message 1 of 4
(6,345 Views)
Solution
Accepted by topic author Jason2018

Use "Boolean to (0,1)". You can put it inside the loop or outside converting whole Boolean array in numeric array

_____________________________________
www.azinterface.net - Interface-based multiple inheritance for LabVIEW OOP
Message 2 of 4
(6,343 Views)

Bool to (0,1) takes care of the Boolean to 0,1 conversion.

 

Building an array in a while loop can be done in several ways, depending on your needs.

 

1) If the array is needed when the loop is done, wire the scalar Boolean through the while loop. Right click the terminal and set tunnel mode to indexing. The output of the loop will be an array.

2) If you require previous array elements in new loop iterations, create a shift register with an empty array constant wired to it. Use Build Array to prepend or append elements to it.

Message 3 of 4
(6,310 Views)

Thank you very much, problem solved.

0 Kudos
Message 4 of 4
(6,274 Views)