LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert string to number

Hi
Have a vi controlling a Keithley 236. It returns a string as a measurement value. I need to do some arithmetic on this and other values. I Can't do this when its a string but when I convert to a number I get a duff conversion.
Any ideas?
0 Kudos
Message 1 of 9
(4,132 Views)
I don't know the definition of "duff conversion" ;). How do you convert?

Please show is how the string looks like and what you want as a result (DBL, U16, etc..).
0 Kudos
Message 2 of 9
(4,117 Views)
What does the string look like? Is it a floating point number, like 1.23, or an exponential, like 10.4e3? If so, use the Fract/Exp String to Number conversion found in the strings palette. If the string contains other characters, you must take a subset of just the numerical expression. If the string is a hex representation of bytes, use the Type Cast function found in Advanced - Data Manipulation.
- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 9
(4,114 Views)
Besides the other comments, there's a driver available for this instrument that already has all of the string to number conversions. You can download it here. It's a pretty old driver (matches the age of the instrument, I guess) but it would provide a good starting point if you feel that you need to create your own.
Message 4 of 9
(4,107 Views)
Thanks a lot guys, I'm going to try all this stuff this morning!

Cheers
0 Kudos
Message 5 of 9
(4,084 Views)
But what is a "duff"?


P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 6 of 9
(4,078 Views)
A "duff" conversion is a conversion which doesn't work.

A "duff" beer (in this sense, not in Springfield ;)) is a really bad beer.

A "duff" anything is a general expression of negativity over the current state of being.

As far as I know.

Hope this helps

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
Message 7 of 9
(4,070 Views)
Yikes..

I've been "DUFFed"!!

😄

Thanks Shane for explanation (and examples).
Message 8 of 9
(4,067 Views)
Hello David,

maybe you have to change the initialization of your Keithley 236. They have some output options (with or without unit/status/etc). Use the output options with just the number, then the conversion should be no problem...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 9
(4,058 Views)