From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Portability issue with "scan from string"

Hi,

 

I need to parse a string to recover some info from it, the string contains geometrical properties of a drilling tool written as a series of five numerical values and a name, for example:

"0, 0.250, 20.000, 0, 0, Con20°_0.25mm"

I did something like this:

 

Immagine.png

and it works:

Immagine.png

 

 

The problem is that when I use this code with the same example string from another computer it doesn't, both computers have the same version of labview (2017 32 bit), how is it possible?

 

0 Kudos
Message 1 of 8
(2,566 Views)

Hi Antares,

 

Have you checked taht both computers use the same Regional and Language options ?

Maybe one is using a '.' (point) as decimal separator whereas the other one uses a ',' (comma).

CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 2 of 8
(2,563 Views)

I agree with Maxime on a possible cause.  If you read the Help for this function, you will see that you can set/override the decimal separator by using what LabVIEW calls the "localization code syntax elements".

 

Are you not parsing at all that last quantity (Con20°_0.25mm)?  You could pull out the "20" part and the 0.25mm part as two more values (or just the 0.25, as you wish).

 

Bob Schor

0 Kudos
Message 3 of 8
(2,551 Views)

Actually they use different configuration for '.' (dot) and ',' (comma).

I tried to set it up properly but it is still not working, I tried from the control panel on windows but probably there is something on labview option panel, can it be?

 

Are you not parsing at all that last quantity (Con20°_0.25mm)?  You could pull out the "20" part and the 0.25mm part as two more values (or just the 0.25, as you wish).

 

No it's ok like this because it is just a name, and the values inside (for example 20 or 0.25) can still be recovered from the numeric array  Smiley Wink

0 Kudos
Message 4 of 8
(2,536 Views)

I tried with Tools/options, disable "use localized decimal point".

 

Now it's working!

 

Thank you Smiley Happy

0 Kudos
Message 5 of 8
(2,525 Views)

I'm not sure the solution you found is the ideal one. When the VI is compiled to an exe or used on a different system this setting might be lost.

Just prepending %.; in front of the format string (this will force the use of . as decimal point) seems the better option.

 

0 Kudos
Message 6 of 8
(2,523 Views)

dan_u is correct.  You really should just set your format string to be:

%.;%f,%f,%f,%f,%f

The %.; forces the format to use the period as the decimal separator.  And just for completeness, you can use %,; to use comma 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 7 of 8
(2,500 Views)

Perfect, thank you all! 

 

0 Kudos
Message 8 of 8
(2,461 Views)