LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert decimal string array to binary string array

Solved!
Go to solution

Hi 

 

Does anyone know how to covert the arrays

 

 

16        00010110

80   to  10000000

0B        00001011

30        00110000

 

Regards

Patrick

 

 

0 Kudos
Message 1 of 9
(4,075 Views)

Yes, I (and many other readers of this Forum) do.

 

Why don't you try to figure it out for yourself?  There are Tutorials mentioned on the first page of this Forum.  Since you are dealing with Strings, examine the functions on the Strings Palette.

 

Bob Schor

 

 

0 Kudos
Message 2 of 9
(4,025 Views)

If your input string array is on hex display and one byte per element, you can try to do something like this (for each element):

Hex String to Binary String.png

If input array is on normal display you have to replace the Unflatten From String function with Hexadecimal String To Number

Lucian
CLA
0 Kudos
Message 3 of 9
(4,010 Views)

@Patrick0830 wrote:

Hi 

 

Does anyone know how to covert the arrays

 

16        00010110

80   to  10000000

0B        00001011

30        00110000

 


First of all, the left side is NOT a "decimal" string (characters 0..9), but a hexadecimal string (characters 0..F). Big difference! You have two nibbles, so you are dealing with a single byte, which can be represented as 8 binary characters (0..1). Is it never more that two hex characters on the left? Does the left side start out as a string array or is it derived from a U8 numeric array?

 

Is this a programming exercise or a process that occurs often and should be as fast as possible?

What have you tried? Once you have code for all 256 possible combinations, you could create a lookup table, right?

 

You could even just leave it as a U8 array and just change the display format, right?

0 Kudos
Message 4 of 9
(3,999 Views)

One possibility?

 

altenbach_0-1584812435442.png

 

0 Kudos
Message 5 of 9
(3,996 Views)
Solution
Accepted by topic author Patrick0830

Another interpretation (all strings are normal display).

 

altenbach_0-1584813133219.png

 

0 Kudos
Message 6 of 9
(3,994 Views)

It works well, thanks.

0 Kudos
Message 7 of 9
(3,945 Views)

Thanks for your suggestion, I am a beginner and have spent over 2 days to figure out how to do it, so I posted here for help.

 

Regards

Patrick

0 Kudos
Message 8 of 9
(3,942 Views)

Thanks, let me have a try.

 

Regards

Patrick

0 Kudos
Message 9 of 9
(3,941 Views)