LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert hexadecimal array to number

Hello,

I'm trying to convert an array Contains some elements of type hexadecimal to number but it doesn't working. So what is the fonction that can this convertion.

Someone can help me.

Cordially.  

0 Kudos
Message 1 of 11
(6,866 Views)

Hello,

I'm trying to convert an array Contains some elements of type hexadecimal to number but it doesn't working. So what is the fonction that can do this convertion.

Someone can help me.

Cordially.  

0 Kudos
Message 2 of 11
(6,847 Views)

"it isn't working".   How are you trying to do it now?  What is it doing wrong?

 

String to byte array, or type cast, or hexadecimal string to number.  One of those functions "may" do what you want.  But if you attach a VI that contains some typical data saved as default, along with an example of how you want that to look, then we can help you connect the dots.

0 Kudos
Message 3 of 11
(6,839 Views)

@mouhamedgmail wrote:

I'm trying to convert an array Contains some elements of type hexadecimal to number but it doesn't working. So what is the fonction that can this convertion.

Your question is way too ambiguous to help you.

 

  • What is the datatype of the array (numeric? string?)
  • What is the meaning of hexadecimal? (Formatted using characters 0..F? String set to hex display?)

 

Please attach a small VI that contains your original data as a diagram constant. Then tell us what result you would like to obtain from it.

0 Kudos
Message 4 of 11
(6,824 Views)

Hi;

I built an array by another array, then i want to concat their elements and convert to a decimal number. I use the convertion byte array to string and then i try to convert the string to number but it isn't working,    

 

Download All
0 Kudos
Message 5 of 11
(6,783 Views)

Hi mouhamed,

 

then i try to convert the string to number but it isn't working

Where do you try this conversion?

 

Use Join instead of BuildArray to create your number…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(6,776 Views)

@mouhamedgmail wrote:

Hi;

I built an array by another array, then i want to concat their elements and convert to a decimal number. I use the convertion byte array to string and then i try to convert the string to number but it isn't working,    

 


Please attach your code so that it has data saved in it.  That means run your VI, Edit >> Make Current Values Default,  Save, Attach to your message.  Be sure to put in an example indicator that shows what you want the end result to be even though you haven't gotten the functions together yet to be able to wire it up.

 

Both Altenbach and I have asked for that, but the VI you attached does not contain any data.

0 Kudos
Message 7 of 11
(6,746 Views)

@mouhamedgmail wrote:

Hi;

I built an array by another array, then i want to concat their elements and convert to a decimal number. I use the convertion byte array to string and then i try to convert the string to number but it isn't working,     


Please:

  • Give your VI a reasonable name. Leaving it as "Untiltled 1.vi" is annoying. My donwloads folder already has dozens on VIs with a similar name.
  • Do NOT maximise the front panel and block diagram to the screen. That is very annoying too.
  • Similar to the term "Hex", your sentence "convert to a decimal number" is very ambiguous. "Decimal" is not a datatype, just a convention to display numerical data. The display format does NOT change the underlying data.
  • Please show us a typical string (e.g. as diagram constant) and tell is what result you like to get from it (datatype, etc.). It seem you end up with 4 bytes, so it could be I32, U32, or SGL. No way to tell! From the image, your final string (after some Rube Goldberg'ian manipulation :D) is "0000 4160" (in hex display). What numeric value do you expect from it? Assuming big endian, it could be 16736 (I32, U32) or 2.34521E-41 (SGL) as displayed in decimal. So what looks right?
  • The rest of the code is quite questionable too. For example for the inner while loop in the left, the number of iteration is fixed and known before the loop starts. Thus it should be a FOR loop. Are you sure the code is right?
0 Kudos
Message 8 of 11
(6,710 Views)

Hi; her is the code, i want to display the result in floating point number. this number displays in hexadecimal is equal 14.0 in floating point number. So i need the fonction that can do this desplay (hexadecimal string to floating point number). that's it 🙂

 thanks

0 Kudos
Message 9 of 11
(6,670 Views)

See if this helps. 😄   (At least we get 14 🐵

 

 

(more about typecasting)

 

Download All
0 Kudos
Message 10 of 11
(6,658 Views)