LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

present string data as boolean !

Solved!
Go to solution

hello !

i am recieving data from UDP READ FUNCTION as string and want to present it as bits (like 10011100-11001100.....)

the string indicator allows me to see the data as HEX/CODES/ASCII only.

your help please.

 

0 Kudos
Message 1 of 7
(4,082 Views)

Hi,

 

Please see the attached VI. I hope you are looking for the same solution.

 

Thanks and Regards

Himanshu Goyal

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
0 Kudos
Message 2 of 7
(4,068 Views)
Solution
Accepted by topic author hookso

I assume you want these "-" delimiters, so here's a quick solution using "array to Spreadsheet string".

 

 

 

0 Kudos
Message 3 of 7
(4,047 Views)

Himanshu Goyal wrote:

Please see the attached VI. I hope you are looking for the same solution.


Himanshu

 

Your code is incorrect and much more complicated than needed.

 

  • Instead of %b, you need to use format %08b, else the binary formatted strings lose their trailing zeroes and all information is lost.
  • I don't understand the reason for the parts after the first loop. They do absolutely nothing! What were you thinking?
  • After creating the faulty output string in the first for loop, you create an array containing the seperate characters, then use built array to convert it to exactly the same 1D array, then you use concatenate strings to merge it back into the single string you had after the first loop already.

 

Here is a corrected version (your original code is on top for comparison) that could be used if the original poster is looking for an output containing no "-" delimiters.

 

 

0 Kudos
Message 4 of 7
(4,036 Views)

Here's an alternative version that produces no delimiters.

 

0 Kudos
Message 5 of 7
(4,011 Views)

TypeCast Man crashes the party:

 

StringToBinary.png

Message 6 of 7
(4,001 Views)

I love the old 4.x mode of typcast! Use it all the time ... 😉

 

It is a shame that "boolean to (0,1)" still does not support output configuration.

 

Here's one with a bit more typecasting. 😄

 

 

 

 

0 Kudos
Message 7 of 7
(3,993 Views)