LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with STRING to NUMBER conversion

Hello all!

I have a problem. I want to convert my exponential string to a number. (This
works just fine on one computer, but on the other I use, it will not work).
If I send the string 38,567 my first mashine responds 3.8567E+1. Quite
correct. The other mashine responds 3.8000E+1.
Why whont it display the decimals?? This is quite important for my
applictation. Thankful for any help!

/Peter Jansson,
Teracom Systemservice Malmoe Sweden
http://www.teracom.se
0 Kudos
Message 1 of 6
(2,891 Views)
Peter,

make sure that bothe machines are using the fomat string "%.4f" during the
conversion.

-Jim

"Peter Jansson, Teracom Malmoe" wrote:
>Hello all!>>I have a problem. I want to convert my exponential string to
a number. (This>works just fine on one computer, but on the other I use,
it will not work).>If I send the string 38,567 my first mashine responds
3.8567E+1. Quite>correct. The other mashine responds 3.8000E+1.>Why whont
it display the decimals?? This is quite important for my>applictation. Thankful
for any help!>>/Peter Jansson,>Teracom Systemservice Malmoe Sweden>http://www.teracom.se>>
0 Kudos
Message 2 of 6
(2,891 Views)
Check for the default decimal separator on both machines.
If it is a point, the string 38,567 will be read as 38

You can force "Scan from string" function to use the comma using the
format:
%,; %f

Jean-Pierre Drolet

Peter Jansson, Teracom Malmoe a écrit dans le message
: 964707994.326378@proxy2...
> Hello all!
>
> I have a problem. I want to convert my exponential string to a number.
(This
> works just fine on one computer, but on the other I use, it will not
work).
> If I send the string 38,567 my first mashine responds 3.8567E+1. Quite
> correct. The other mashine responds 3.8000E+1.
> Why whont it display the decimals?? This is quite important for my
> applictation. Thankful for any help!
>
> /Peter Jansson,
> Teracom Systemservice
Malmoe Sweden
> http://www.teracom.se
>
>
0 Kudos
Message 3 of 6
(2,891 Views)
Hello again.

I convert my string from using 38.124 to use 38,124. It then goes to the
"From Exponential/Fract/Eng" VI that outputs a number. On the first computer
it responds 38,124. The other responds 38.000. This is when I execute my
APPIC.EXE. When compiled, it should do the same job on both computers,
right?

Thanks again!
/Peter

--
/Peter Jansson,
Teracom Systemservice Malmoe Sweden
http://www.teracom.se
"Peter Jansson, Teracom Malmoe" skrev i meddelandet
news:964707994.326378@proxy2...
> Hello all!
>
> I have a problem. I want to convert my exponential string to a number.
(This
> works just fine on one computer, but on the other I use, it will not
work).
> If I send the string 38,567 my first mashine responds 3.8567E+1.
Quite
> correct. The other mashine responds 3.8000E+1.
> Why whont it display the decimals?? This is quite important for my
> applictation. Thankful for any help!
>
> /Peter Jansson,
> Teracom Systemservice Malmoe Sweden
> http://www.teracom.se
>
>
0 Kudos
Message 4 of 6
(2,891 Views)
Peter,

Check your regional settings in both computers' Control Panel. Look
under the "Number" tab at the field labeled "Decimal symbol:". Are
these settings the same? The computer that responds "38.000" is using
the period (.) as the decimal symbol and not a comma (,). If you
change this setting, your application should work properly.

eric

article <965026653.980830@proxy2>,
"Peter Jansson, Teracom Malmoe" wrote:
> Hello again.
>
> I convert my string from using 38.124 to use 38,124. It then goes to
the
> "From Exponential/Fract/Eng" VI that outputs a number. On the first
computer
> it responds 38,124. The other responds 38.000. This is when I execute
my
> APPIC.EXE. When compiled, it should do the same job on both computers,
> right?
>
> T
hanks again!
> /Peter
>
> --
> /Peter Jansson,
> Teracom Systemservice Malmoe Sweden
> http://www.teracom.se
> "Peter Jansson, Teracom Malmoe" skrev i
meddelandet
> news:964707994.326378@proxy2...
> > Hello all!
> >
> > I have a problem. I want to convert my exponential string to a
number.
> (This
> > works just fine on one computer, but on the other I use, it will not
> work).
> > If I send the string 38,567 my first mashine responds 3.8567E+1.
Quite
> > correct. The other mashine responds 3.8000E+1.
> > Why whont it display the decimals?? This is quite important for my
> > applictation. Thankful for any help!
> >
> > /Peter Jansson,
> > Teracom Systemservice Malmoe Sweden
> > http://www.teracom.se
> >
> >
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 5 of 6
(2,891 Views)
ej wrote:

> Peter,
>
> Check your regional settings in both computers' Control Panel. Look
> under the "Number" tab at the field labeled "Decimal symbol:". Are
> these settings the same? The computer that responds "38.000" is using
> the period (.) as the decimal symbol and not a comma (,). If you
> change this setting, your application should work properly.
>
> eric
>

If this is a built executable you should make a copy of the ini file as
well.
This is based on the labview.ini but will be named the same as the
executalbe.
(ie myapp.ini if the app is myapp.exe). There are a couple of other things
that
need to be changed in the ini file, check the documentation.
0 Kudos
Message 6 of 6
(2,891 Views)