Convert a String Output into a Single Numeric Value

Updated May 29, 2018

Reported In

Software

  • LabVIEW

Issue Details

I have a string as output when I read from one of my devices. How do I convert this string into a single numeric value that I can manipulate?

 

Solution

A string or set of characters is received as output when reading from instruments using protocol such as VISA or serial. This can typically be converted into an array of bytes using the String to Byte Array function in the Functions Palette in Programming» String» String/Array/Path Conversion. However, if you need to convert it into a single numeric value that is much easier to manipulate, there is no direct method.

Instead, the data must be converted from a string into a byte array. Each element of that array needs to be converted into 8 bit boolean arrays and concatenated into a larger boolean array the size of the representation of the number. Then, that larger boolean array is converted into Output Data.

WAS THIS ARTICLE HELPFUL?

Not Helpful