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: 

String of binary to text

Solved!
Go to solution

Hi there,

 

I was wondering whether you could convert a string of 01110010010 (for example) into text, so if I entered 01111110 I would get ~.

 

Regards,

Christopher

0 Kudos
Message 1 of 15
(5,467 Views)

If i understand you right, you want to convert a number to its ascii representation, right?


Kudos are the best way to say thanks 🙂
0 Kudos
Message 2 of 15
(5,465 Views)

 

This should do it.Capture.PNG

 


Kudos are the best way to say thanks 🙂
0 Kudos
Message 3 of 15
(5,462 Views)

You can also see this. https://forums.ni.com/t5/LabVIEW/Converting-a-binary-string-to-a-number/m-p/33935

You'd use scan from string if you have a binary string.


Kudos are the best way to say thanks 🙂
0 Kudos
Message 4 of 15
(5,455 Views)

@programlad19 wrote:

so if I entered 01111110 I would get ~.


How is that value being entered?  Is it a single byte with Binary radix/display?  A string of just 1s and 0s in ASCII?

 

Assuming a single byte, the use Build Array and Byte Array To String.

 

If the string of 1s and 0s in ASCII, then I would use Scan From String with "0b8" as the format to convert to a U8.  Then you just use the Build Array and Byte Array To String to get your character.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 15
(5,434 Views)

Oh no I mean like an actual string. So it would be a string (pink) with 1s and 0s inside it. Not sure how you would convert that to a text string.

0 Kudos
Message 6 of 15
(5,417 Views)

Capture.PNG

 

This is what you need.


Kudos are the best way to say thanks 🙂
Message 7 of 15
(5,415 Views)

That only works for the first letter. So the way my system works is it takes in a bunch of binary values which no spaces in between for each character, so for example 0110100001100101011011000110110001101111001000000001010 would be the binary string which I want to convert to hello.

0 Kudos
Message 8 of 15
(5,412 Views)

Whats the source of the data being streamed & size of each data packet? I am assuming its an unsigned 8-bit? You'd have to parse your data packet based on the packet size and then apply the VI that i shared in my previous post.


Kudos are the best way to say thanks 🙂
0 Kudos
Message 9 of 15
(5,402 Views)
Solution
Accepted by programlad19

BinaryString.png

0 Kudos
Message 10 of 15
(5,397 Views)