LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I do the conversion from a string to a float

Hi,
I need to take a string, which is the time and to convert it into a float, because the program I send it to is only receiving a float...how can I do that?
0 Kudos
Message 1 of 18
(2,917 Views)
In the strings-palette, there's a subpalette called "String/Number"-conversion...Just use Fract/Exp-String to Number to convert your string

Greetings

Christian

THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 2 of 18
(2,915 Views)
It may not be as simple as that. Is the string simply the float value as a string (in which case you can do the above), or is it in a specific format?
0 Kudos
Message 3 of 18
(2,908 Views)
let me explain, if the time is the string 18;30;36 I want the float 183036 kind of
0 Kudos
Message 4 of 18
(2,904 Views)

well assuming the time is broken up by semicolons as you have shown,
first, split up the time, using ";" as your split character.
then, you have three segments: hours, minutes, seconds.

Then i would convert each of those (using string --> dbl or something like that)

Then you have 3 numbers to do whatever you would like with.

Cory K
0 Kudos
Message 5 of 18
(2,899 Views)

well assuming the time is broken up by semicolons as you have shown,
first, split up the time, using ";" as your split character.
then, you have three segments: hours, minutes, seconds.

Then i would convert each of those (using string --> dbl or something like that)

Then you have 3 numbers to do whatever you would like with.

Cory K
0 Kudos
Message 6 of 18
(2,898 Views)
There can be different approaches, just two of them: Use Scan from String to get the different parts of your string as Number or eliminate your ;;; from your string with "Search and replace string"...




Greetings, Christian



Message Edited by cschneider on 08-07-2008 11:13 PM

THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 7 of 18
(2,888 Views)

Heres the program that I was describing earlier (and accidentally posted twice oops)

 

Cory K
0 Kudos
Message 8 of 18
(2,882 Views)
Scan From String is a lot easier, don't you think? Smiley Wink
0 Kudos
Message 9 of 18
(2,874 Views)
My contribution to the conversions...gives you a 1D array of 3 elements (one for each section of the string).


Message Edited by corys on 08-07-2008 03:14 PM
-Cory
0 Kudos
Message 10 of 18
(2,868 Views)