LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fract/exp string to number problem.

Solved!
Go to solution

Hi ppl,

 

I have very simple question. I want to convert string 5.3696075E-4 to the number. in my program it gives me only 5.

plz, help me.

 

 

0 Kudos
Message 1 of 10
(7,524 Views)

Hello,

 

One thing to check might be your "Display Format..." (right-click on the indicator) and make sure you're setting the number of significant digits, or digits of precision sufficient to show the complete value.

 

When you say you only get 5... I presume you mean 5E-4, or 0.0005 correct?

 

That could be just a display format issue then...

 

 

Does that help?

 

If not, can you post a screenshot of what you're seeing just in case?  I say a screenshot because I'm seeing your code execute as expected, returning all the relevant digits in the numeric representation.

 

 

Best,
JLS
Sixclear
0 Kudos
Message 2 of 10
(7,515 Views)
Solution
Accepted by topic author dimani4

Your operating system is most likely set to use a comma instead of a period as the decimal separator.

 

The Fract/Exp String to Number function has an optional Boolean input at the top. The default is True, telling LabVIEW to use the OS system setting for the separator.

 

Set the 'use system decimal point (T)' to False and that should allow you to convert the string properly...

 

Message 3 of 10
(7,500 Views)

yeah.. you're right .. thanks 🙂

0 Kudos
Message 4 of 10
(7,494 Views)

hi

 I have almost the same problem ,infact my project is GPS  tracking with  labview and Google Map. I have made ​​good progress, but I'm stuck right now because actually I have a lot of points  to place on my map,

latitude         longitude

49,866872    8,641218
49,866873    8,641218
49,866873    8,641218
49,866875    8,641218
49,866875    8,641217
49,866875    8,641217
49,866875    8,641217
49,866875    8,641218
49,866875    8,641218
49,866873    8,641218
49,866872    8,64122
49,86687    8,64122
49,866872    8,641218

 

My issue is , I read a text file,and  I would like 6 digits after the coma but the function  give me juste four digits after the coma .... so could you tell me how I have to do?


 

 

 

 

 

Here is  a piece of my program, the problem is that my numbers are displayed with two digits after the comma, while I want to have at least 6 see 7.
because right now I have the trick of default is '% .3 f' ...

0 Kudos
Message 5 of 10
(7,362 Views)

Hi paco,

 

some thoughts:

1) There's a difference between "digits displayed" and "digits in memory". If it's only a display problem you have to edit the display settings of your numeric indicator.

2) Given your example I would use a format string of "%,;%f"

3) Setting the decimal digits in the format string is usually ignored when converting string to number, so there is no difference in using "%f" of "%.3f"...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 10
(7,359 Views)

I called NI few days ago, a technician helped me but it's still not working, my project works, but if I could display more digits after the decimal point, my points on my map would be more accurate..

Furthermore , do you how i could add a scale on my map?

 

thanks for your reply

0 Kudos
Message 7 of 10
(7,337 Views)

Hi paco,

 

"but it's still not working, my project works"

Does it work or doesn't it work? You are unclear in that point... Smiley Wink

 

"but if I could display more digits after the decimal point, my points on my map would be more accurate."

Just do so...

 

"do you how i could add a scale on my map?"

I don't know your VI nor do I know your map...

I can only guess: you draw your map in an indicator. Most (graphical) indicators in LabVIEW allow additional picture overlays, use them to show your scale in the map...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(7,334 Views)

hi

 

"""but it's still not working, my project works"

Does it work or doesn't it work? You are unclear in that point..."""

 

My project works ,  but when I used  a probe in order to see how many digits are there after the coma, I see juste 4 digits ,but I would like to be more accurate I need at least 6 or 7 digits..

"do you how i could add a scale on my map?"

 

currently ,I'm using google map, and i need a scale on it but I don't know

 

attached my project.

 

but add this figures  on a editor

 

49,866872    8,641218
49,866873    8,641218
49,866873    8,641218
49,866875    8,641218
49,866875    8,641217
49,866875    8,641217
49,866875    8,641217
49,866875    8,641218
49,866875    8,641218
49,866873    8,641218
49,866872    8,64122
49,86687    8,64122
49,866872    8,641218

0 Kudos
Message 9 of 10
(7,325 Views)

Hi paco,

 

you must learn to differentiate between the number of digits displayed and the number of digits used internally! Any indicator can be configured to show more than 4 digits, but it's up to you to change that (yes, also for probes!)...

 

See attachment, it converts your string example into an array of DBLs. The DBLs are displayed with more digits than usual - it's configurable in the indicator properties!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 10
(7,320 Views)