LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert string to float

Solved!
Go to solution

Hi,

 

I would like to convert string to float. I have an text file which contents string float number.

 

for example:

 

10.000   2. 0000  1.32323 these strings I would like to convert float or double number.

 

Please help!

 

 

0 Kudos
Message 1 of 16
(32,597 Views)
You can use "format into string"
0 Kudos
Message 2 of 16
(32,588 Views)

Use "Fract/Exp String To Number" function from string palette.  Or while reading from file use "Spreadsheet String To Array" with array type as DBL array.

 

 

 

-Kumar.B

Message 3 of 16
(32,587 Views)
"Decimal string to array"
0 Kudos
Message 4 of 16
(32,582 Views)
I think Kumar is good on this one.  It returns all the digits of the text based number rather than just the intiger portion returned by the other alternative.
Message 5 of 16
(32,500 Views)
Solution
Accepted by Tamas

I use the spreadsheet string to array vi and I have to set correct the format string.

 

%.; %f

 

Thanks everybody!

Message 6 of 16
(32,469 Views)

 Hi guys,

 

Im trying to convert a string to float number too, but my string comes from a text file and has to be converted to float but i cant make it reconize the (.) divisor. I gonna send a pic of my code. any suggestions.Untitled3.png

0 Kudos
Message 7 of 16
(29,682 Views)

You don't want Decimal String to Number (which will only give you an integer).  You want Fract/Exp String to Number (which will give you a floating point number).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 16
(29,676 Views)

Yes lol i used it before but the wrong way.. now it works thx. and sory for dumb question... its to many hours around the program 😄

0 Kudos
Message 9 of 16
(29,672 Views)

asnaev wrote:

Im trying to convert a string to float number too, but my string comes from a text file and has to be converted to float but i cant make it reconize the (.) divisor. I gonna send a pic of my code. any suggestions.Untitled3.png


Looking at the picture, I think you have several more problems than just converting to floating point. I would be happy to look at your code and give some recommendations if you would attach the VI.

 

  • What did you possibly have in mind when doing the "to dynamic...from dynamic" dance in the upper left corner? We cannot see the node configuration, but are you possibly trying to emulate a transpose operation? There are better ways!
  • You seem to have a lot of duplicate code that could be combined.

 

0 Kudos
Message 10 of 16
(29,665 Views)