LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array of Boolean to String

Solved!
Go to solution
Hello All,
 
I have a small coding challenge that has been whipping me all day.   I have a 19 element boolean array that I would like to convert to a string without delimiters("0000000000000000000").    Within a for loop I use a "Select" followed by a "Number To Decimal String."   Once outside the loop then use the "Array To Spreadsheet String" function on the indexed output.    I tried using a blank delimiter input on the "Array To Spreadsheet String" function but that reverts back to tabs.   Bummer.   I'll keep plugging away trying different functions and constructs, but this feels harder than it really should be.    Any fresh prespectives would be greatly appreciated!
 
Sincerely,
Zach
0 Kudos
Message 1 of 15
(15,694 Views)
Hello,

You could try something like this:






Message Edited by jmcbee on 08-05-2008 03:00 PM
Message 2 of 15
(15,683 Views)
Even simpler:




Message Edited by smercurio_fc on 08-05-2008 04:01 PM
Message 3 of 15
(15,677 Views)
Beat me to it, and mine's pretty much the same...but here it is, since I spent the time taking the picture anyway 😛



Message Edited by corys on 08-05-2008 04:02 PM
-Cory
Message 4 of 15
(15,674 Views)
I never knew that concatenate strings worked that way on arrays, this is a very useful thing to know!

Thanks Smercurio!
0 Kudos
Message 5 of 15
(15,667 Views)
Solution
Accepted by super-neuron


super-neuron wrote:
  I have a 19 element boolean array that I would like to convert to a string without delimiters("0000000000000000000").
"Boolean to 0,1" - > "Number to decimal string" -> "concatenate array". No loop needed.
 

 


EDIT: looks like smercurio beat me to it. 😄

Message Edited by altenbach on 08-05-2008 02:09 PM
Download All
Message 6 of 15
(15,658 Views)
Aha...didn't realize the concatenate string worked like that. It is quite handy! (So is reading the context help, I now realize 😛 )
-Cory
0 Kudos
Message 7 of 15
(15,652 Views)

The simplest way I know how.  Note that it will pad with leading zeros when necessary to make sure you get all 19 bits/characters.

 



Message Edited by centerbolt on 08-05-2008 05:15 PM
Message 8 of 15
(15,647 Views)
Just for kicks, here's another "no loop" version. Does not even use "concatenate string" 😄
 
 
(This will not work if you have more than 32 booleans). I reversed the input array to give the same reuslt as the other solutions.
 
 


Message Edited by altenbach on 08-05-2008 02:16 PM
Download All
Message 9 of 15
(15,644 Views)
Gah...I *knew* there was a way to do it like that (Altenbach / Centerbolt). For some reason I kept missing a little something, so just went with the next train of thought that came to me on how to do it.
-Cory
0 Kudos
Message 10 of 15
(15,628 Views)