LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scan from String , can't get number from string

Solved!
Go to solution

hello 

I've just started lerning LabView and i've got problem that I can't overcame. Topic is simple , I have string ( let say exactly like in screen shot ) 14.12 and I would like to change it to a number because it will be send to graph. As you see after scanning from string I get Output 14 , and remaining string .12  😞 I need Output = 14.12   I've serched on this forum topics conected with this mater but I can't find answer. Mayby someone can help me 🙂  

 

Working on LabView 2017 x64

Download All
0 Kudos
Message 1 of 8
(4,953 Views)
Solution
Accepted by topic author dabrowskp

Well, in LabVIEW 2016 32-bit, I get 14.12 as Output 1 and nothing in Remaining String.  Some thoughts:

  • Is your PC set to use the comma (",") as the decimal indicator (i.e. 14,12)?  This would definitely produce the output you are seeing.  Try changing the input string to 14,12 and see what happens ... 
  • You can specify whether a Comma or Period is the decimal separator.  To specify the Period, start the Format Specifier with "%.;".  You can read more about this by reading the Help for Scan from String and following the links to Format Specifier Syntax.
  • This could be a bug, but it hardly seems reasonable that this would escape even the shorter Development/Testing time for LabVIEW 2017 (not to mention that it has been in Users hands for almost 6 months).

Bob Schor

Message 2 of 8
(4,941 Views)

@Bob_Schor wrote:
  • Is your PC set to use the comma (",") as the decimal indicator (i.e. 14,12)?  This would definitely produce the output you are seeing.  Try changing the input string to 14,12 and see what happens ...

Looking at the front panel shown in 2.jpg, this is definitely the case.

 

OP, use "%.;%f" as your format string.  The "%.;" forces the use of the period as the decimal separator.


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 3 of 8
(4,908 Views)

Tools options environment has a checkbox to use some stem decimal seperater.  Make sure it is checked.  If it is.  You should not need to add the %,; in scan from string.


"Should be" isn't "Is" -Jay
Message 4 of 8
(4,904 Views)

Hi Jeff,

 

while I use this setting from time to time too I still advise NOT to set this checkmark!

Users get easily annoyed/distracted when the LabVIEW-written tool is not following their regional settings…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 8
(4,896 Views)

Actually I was right and wrong

 

Read too fast.  The checkbox is set by default to use statement settings.  crossrulz pointed out that the OP apparently has a comma decimal seperater so to correctly scan nn.dd the %.;%f is needed.


"Should be" isn't "Is" -Jay
Message 6 of 8
(4,878 Views)

Fract String to Number.jpg

Ing. Ovidio Torres (El Salvador).

Message 7 of 8
(4,854 Views)

Guys you are the best 🙂 you made my day 🙂

I haven't thought abaut that because I have been working on this project for a while and elier everything was working.  Probaply this problem is all my fault, I remember that I have instaled a few updates  and probably my regional setings have been changed.

Thanks again 🙂 

 

Best regards 

0 Kudos
Message 8 of 8
(4,812 Views)