Search code examples
labview

Convert 4 Byte String Array of Hex to Decimal


I am trying to convert a string of 4 bytes in a string to an integer number in LabView, currently I am using the string subset to break apart my string and then storing it into a String Indicator on the front panel, however, I need to convert that string to an int so I can show the decimal value as well as convert it from inches to mm. Here is what I'm doing now: String conversion

I've tried converting to double using the convert string to double functions as well as I've tried splitting it up using the index array...can't quite seem to get an int out ever. Thanks!


Solution

  • Do as Ton Plomp said and use the Scan From String block. However, in yours, you don't want to separate with commas and with spaces. Just do:

    %x%x%x%x
    

    And that should do it for ya. Don't forget to pull the scan down so you have 4 outputs.