LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String to Number conversion

Solved!
Go to solution

Hello all,

 

I need to convert string like "-73.28" to number -73.28. With Decimal String To Number Vi I get only -73,00 output with "-73.28" string input. What I do wrong? How to get needed output? Notice also that , needs to be . in the output number!

 

Thanks!

0 Kudos
Message 1 of 46
(16,671 Views)

Decimal String To Number returns, as easily seen by the color of the wire, integer numbers. You are therefore using the wrong function.

You are looking for "Fract/Exp String To Number".

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 46
(16,657 Views)

Hi,

 

in most cases, it´s a "decimal point character".

 

When you´r working on a machine which is set for example to german language, the decimal point is an "," on english systems, it´s most of the times the "."

 

You have to set the decimal character to search for in the "Scan from string" function like in this example:

scanDBLfromStr.png

 

Stefan

Message Edited by SK@NIG on 04-23-2010 08:30 AM
0 Kudos
Message 3 of 46
(16,656 Views)
Dont use the Decimal String to Number VI.  Use the Fract/Exp String to Number VI.
Herrlin

Just trying to spread the LabVIEW love.
0 Kudos
Message 4 of 46
(16,653 Views)
See here and post back if you need further help. The example is too old to be opened with recent LV versions.
0 Kudos
Message 5 of 46
(16,649 Views)

Hi,

 

And thanks for your help but he "comma problem" is still there as you can see from the picture. Because the input has a dot (.) as a separator, the output needs it too. Now output has a comma (,). Is there some kind of a setting in Labview I need to check?

 

Regards,

Jick

0 Kudos
Message 6 of 46
(16,574 Views)

Hi again,

 

I just noticed that I can't enter dots(.) to a numeric control. Only commas (,). So there must be a setting to check somewhere...?

 

Jick

0 Kudos
Message 7 of 46
(16,563 Views)
Solution
Accepted by topic author Jick

Hi Jick,

 

first of all: having the "," decimal separator in a numeric indicator is just for cosmetic purposes, you still can calculate using this value...

 

1) You may change the settings of the OS (Win: Regional Settings aka Regionale Einstellungen). I do this for all of my computers as it seems "natural" for me when working with scientific/measurement data Smiley Wink

 

2) You may switch LV to ignore system decimal separator settings - you find that in the options dialog...

 

But when using properly formatted output functions you don't need to change any setting... 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 46
(16,554 Views)

Hi,

 

The problem is that I am passing the number to the another program which does not undestand commas as a decimal separator. So I just thought that is there any simply way to convert commas to dots in Labview. I'll try to change options. Thanks!

 

Jick

0 Kudos
Message 9 of 46
(16,549 Views)

Hi Jick,

 

how are you passing the number to your other program?

 

Most of the times it is a matter of proper string formatting. Read the help on format codes, there you find hints on dot/comma conversion too!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 46
(16,546 Views)