LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Number Array to Boolean Array ??

Solved!
Go to solution
I am trying to read in an array of four values that are either "0" or "1" and I want to convert them to boolean true/false so that I can write true/false to a digital TTL signal from my USB-6008 DAQ. I'm using LabVIEW 8.0.
 
To simplify the problem, I have created the vi attached. Is there a way to make this work? It is currently only reading the first of the four values.
 
Michael J Fidler
0 Kudos
Message 1 of 24
(10,399 Views)
An easy way to convert numeric 0s and 1s to their boolean conterpart is simple using the !=0 function.
 
So there is no reason to do all the conversions you are doing, simply take the value do the comparison and build your array.
Message 2 of 24
(10,392 Views)
Thanks Evan, but could you be a little more specific? I don't know what the "!=0" function is and nothing shows up in the LabVIEW help when I search for !=0.
 
Michael J Fidler
0 Kudos
Message 3 of 24
(10,387 Views)
Solution
Accepted by topic author Michael_Fidler
"Not equal zero" from the comparison palette. 😉
Message 4 of 24
(10,387 Views)

Simply amazing. Thanks guys!

Michael J Fidler

0 Kudos
Message 5 of 24
(10,378 Views)
Here's a quick example:
 

Message Edited by altenbach on 05-01-2007 12:22 PM

0 Kudos
Message 6 of 24
(10,373 Views)
The funny thing is that I didn't even think of spelling it out.  I think I am having a nerd day. Smiley Indifferent
0 Kudos
Message 7 of 24
(10,366 Views)

When I see "!" I think "bang" and not "not". Now I know.

Michael J Fidler

0 Kudos
Message 8 of 24
(10,362 Views)

Looks like I'm too slow, but here is my response anyway:

There is a function called Boolean to (0,1), I wish there was (0,1) to Boolean function.  I usually just use the Not Equal to Zero function to output a boolean.  0 causes a false and 1 causes a true.  Then just build an array of the 4 booleans.

Message Edited by tbob on 05-01-2007 01:33 PM

- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 24
(10,360 Views)


@tbob wrote:

Looks like I'm too slow, but here is my response anyway:

There is a function called Boolean to (0,1), I wish there was (0,1) to Boolean function. 



It's called typecast, in general true is defined as !0 (or not zero for the not so nerds).

Be aware that typecasting width different data sizes you can get strange results.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 10 of 24
(10,352 Views)