Friday, May 31, 2013

String/number conversions in LabVIEW

My LabVIEW program is mostly working after a long week. All in all, the design and implementation of the program went well, since it's now working. However, the implementation is very rough and I know that my LabVIEW programming skills can be improved a lot. In particular, I need to decide when global variables are necessary to use and when they're not, make better use of error handling and other forms of feedback for moving through sequences (beyond just using the Wait function for a long time), and make better use of subVI's.

One annoying aspect of LabVIEW that I've learned to appreciate through all of this is its string/number conversions and data types. One 12-hour measurement was wasted because I thought "Convert to Decimal Number" meant that I could take a string such as "42.5" and convert it to a number with decimal places, like 42.5. Unfortunately, inputting "42.5" into this function produces 42 at the output. A quick get-around is to use "Convert to Exponential Number," but I think I'll want to use "Format Value" and supply a format string to ensure that I'm converting correctly.

Here is a list of string/number conversion functions and their descriptions. I will be using this list, as well as the list of numeric data types, more frequently since I find them unintuitive.