Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa Read to Return a Double Type

I'm using labview 7.0. I'm trying to use Visa Read to read from a serial port. The data return is in string type. What code should I add in order to convert the string to a double type?

I had tried using the "Decimal String to Number" function, but using this will only return a Integer which is not what I intend to have.

Thank you.
0 Kudos
Message 1 of 3
(3,210 Views)
Just like the context help states, Decimal String to Number converts to integers. On the same palette, you'll find Fract/Exp String to Number and on the top level String palette you'll find Scan From String wchich can do the same thing with a %f format string.
Message 2 of 3
(3,210 Views)
If the data being returned is a string of numerics such as 14.3, then you should be able to use the previous answer to this question. However, if the data being returned is raw data (simply being represented as a string when returned from the VISA read function) you can type cast the data to the type you expect (in this case double). The LabVIEW type cast function is located in the following palette: All Functions -> Advanced -> Data Manipulation.

Get back if you are still having trouble!

Regards,

Jassem
Applications Engineer
National Instruments
Best,
JLS
Sixclear
0 Kudos
Message 3 of 3
(3,210 Views)