LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

digits gone missing while converting string to number

Solved!
Go to solution

I have a quite unussual problem and can't find any solution. The problem is following.

I get the measurements from a multimeter as a string and it looks like this:  "3.7260900E+00". Then I want to put this numbers on a waveform chart and I must convert them to numbers. Whichever VI to convert I use, everyone returns only the first digit in this case: "3".

What should I do to get the full number onto the chart? I allready tried to use more digits in the properties of the chart, but this doesn't have any effect.

 

Thanks for help.

0 Kudos
Message 1 of 12
(4,475 Views)
Scan from string using %f (you can specify the format using the typical printf % clauses).
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 12
(4,470 Views)
Solution
Accepted by topic author Marlon8781

Hi Marlon,

 

you probably use a PC with "German" regional settings, i.e. using comma as decimal separator. So you should try this:

sfs.png

The format code "%.;" sets the point to be used as decimal separator, in contrast to your regional settings.

 

That's the reason why I set all measurement systems to use English regional settings (atleast swap the German point/comma settings).

 

Btw. increasing the precision of the chart doesn't change the data wired to it Smiley Wink

Message Edited by GerdW on 09-09-2009 02:20 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 12
(4,469 Views)

GerdW wrote:

Hi Marlon,

 

you probably use a PC with "German" regional settings....


How did you glean from his post that he's using decimal comma?

Richard






0 Kudos
Message 4 of 12
(4,454 Views)

Hi BrokenArrow,

 

well, when "3" is all Marlon gets with all string to number conversions then it's most probably a wrong regional setting...

 

(And I also had to learn the hard way that inclusion of "%.;" will get rid of nearly all problems with string to number conversion in Germany Smiley Wink )

Message Edited by GerdW on 09-09-2009 02:52 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 12
(4,449 Views)
Thanks for the fast response. It's working now. :smileyvery-happy:
0 Kudos
Message 6 of 12
(4,446 Views)

GerdW wrote:

Hi BrokenArrow,

 

well, when "3" is all Marlon gets with all string to number conversions then it's most probably a wrong regional setting...

 

(And I also had to learn the hard way that inclusion of "%.;" will get rid of nearly all problems with string to number conversion in Germany Smiley Wink )


Very cool GerdW, thanks for the information. Smiley Happy

Richard






0 Kudos
Message 7 of 12
(4,423 Views)

Hi,

 

I rather wander how GerdW new, that Marlon8781 had German Regional settings. Smiley Surprised

 

There is so many regional settings which uses decimal separator other than point.

 

 

Anyway, you can set your LabVIEW to not use localized decimal point. Open Tools - Options, and navigate to Front panel category. Under General section, you can find settings "Use localized decimal point". Uncheck this setting to use decimal point independently of your local settings. This can be useful if you are not familiar with % style formatting and you don't want to change regional settings.

 

 

Best regards,

Martin

 

 

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 8 of 12
(4,386 Views)

Hi Martin,

 

does this setting also help when deploying apps to other computers using different regional settings?

 

Even when you set your IDE to use "standard" settings, an app may not do so when used on customer's computer. So I would opt for learning some simple %-codes Smiley Wink

Best regards,
GerdW


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

Hi GerdW,

 

You are correct that this setting will have no influence on your deployment. However, I believe it is good to notice it, because not everybody needs to deploy their code as executable. 

 

 

Anyway, I agree you are right about learning simple %-codes Smiley Tongue

 

 

 

P.S. How did you know he had "German" regional settings? Smiley Surprised 

 

Regards,

Martin

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 10 of 12
(4,370 Views)