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
(2,981 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
(2,979 Views)

 

This should do it.Capture.PNG

 


Kudos are the best way to say thanks 🙂
0 Kudos
Message 3 of 15
(2,976 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
(2,969 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.


GCentral
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
(2,948 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
(2,931 Views)

Capture.PNG

 

This is what you need.


Kudos are the best way to say thanks 🙂
Message 7 of 15
(2,929 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
(2,926 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
(2,916 Views)
Solution
Accepted by topic author programlad19

BinaryString.png

0 Kudos
Message 10 of 15
(2,911 Views)