LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Join byte array to number

Hello, I have a litle problem: I have to create a decimal number from byte array. For exemple:

Array

01

12

24

34

34

32

Number -> 011224343432

Thanks

 

0 Kudos
Message 1 of 10
(37,264 Views)

Hi maumontesi,

 

There is a convert from byte array to number function located in the Programming>>Numeric>>Conversion pallette. The function is called "Boolean Array to Number".

 

I hope this helps,

 

Thanks,

Andrew McLennan
Applications Engineer
National Instruments
Message 2 of 10
(37,260 Views)

If you have the "byte array" as strings you can just wire the array to concatenate strings and then use decimal string to number.

See screenshot.

 

 

Message Edited by dan_u on 09-30-2008 01:24 PM
Message 3 of 10
(37,246 Views)

Hi Andrew

 

Would you please put a picture(as done by dan) of the method suggested by you.

Thanks & Regards,
Rajan
0 Kudos
Message 4 of 10
(37,237 Views)

The question is a bit vague as we don't know what the data types involved are. In the example presented, if the "decimal number" is in an integer type it would have to be a 64 bit value as the example presented is beyond the range of a 32 bit value.

 

So the attached MIGHT be what the OP is looking for. I've set the properties (Format and precision) of the indicator and control to allow leading zeroes and the appropriate field length. But of course this example will only work if the array entries are numerically less than 100.

 

Or maybe the array elements are actually strings, and you want one long string. That's just the concatenate part of Dan's post.

 

Or are these the hex representation of 8-bit bytes, and the answer is also shown in hex?

 

Rod.

 

0 Kudos
Message 5 of 10
(37,220 Views)

Hi All,

 

Attached are the two solutions that I came up with. The first is simply converting a Boolean Array to a Numeric number as shown in example 1. The second example (example 2) takes boolean words and then converts them into numbers stored in an array. 

 

Thanks,

 

 

 

 

 

 

Message Edited by Andrew McL on 09-30-2008 08:02 AM
Andrew McLennan
Applications Engineer
National Instruments
Download All
Message 6 of 10
(37,206 Views)

>>There is a convert from byte array to number function located in the Programming>>Numeric>>Conversion pallette. The function is called "Boolean Array to Number". 

 

Hi,

 

Where exactly is that? And is it available on version 8.6? Because the only thing I can find is "Byte array to string" function on that pallette.

Message Edited by Azzimuth on 03-04-2010 08:14 AM
0 Kudos
Message 7 of 10
(35,919 Views)

They re-aranged the furniture since this thread was live.

 

Look on the Boolean palette.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 10
(35,910 Views)
Thanks! But it turned out this won't work for what I need. I need a byte array to integer converter. Do you have a suggestion how do I do that? In particular, I need to convert 2 bytes to a 16-bit unsigned integer.
0 Kudos
Message 9 of 10
(35,907 Views)

See your other thread.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 10
(35,902 Views)