LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert scientific string to number ?????

Hello,
 
Could anybody tell me how I can convert a scientific string to a number ( for ex : String 7.4E-1 to 0.74 )  ? 
 
Any help would be great !
 
Regards,
 
David
0 Kudos
Message 1 of 9
(6,444 Views)
Try this. 7.0 format. This vi is located in the All functions, String, String/number conversion on the block diagram.
Message 2 of 9
(6,439 Views)

Hi Unclebump,

 

Thanks for ur answer, it works fine.

cheers,

David

0 Kudos
Message 3 of 9
(6,414 Views)
Hi
 
I have the same problem here, but this example does not work.
The number I try to convert ifor example is 2.78242e-03, and the answer it gives me is 2
 
I tried to change the precision of the indicator to the 10th digid, and tried different format modes but it does not work.
Can somebody help??
 
I have another issue of the same kind. I am trying to convert a fractional number to string, but it does not work.
For example I input a DBL value 2, divide it by 1000. The result shown is 0,002. Then I try to convert this to a string and the answer is " 0, ".  What I need to get as a result when I convert it to string is "0.002"
 
I think I have some problems with those "," and "." dividing the fractions but I cannot figure it out. I also tried to change my windows setting to have a default value "." which is separating them but it does not work out. 
 
I am using MathLab 8.5
 
Please help.
 
Thank you for your responses.
0 Kudos
Message 4 of 9
(6,254 Views)

Hi andreevz,

if i use the before attached example and insert you example number, it works fine for me. I work with a point as decimal seperator.

Mike

Message 5 of 9
(6,251 Views)
Sorry for troubling guys.
 
A good old fashioned restart fixed the problem fine Smiley Happy
0 Kudos
Message 6 of 9
(6,246 Views)
Hi andre,

you can override system settings using special format codes in string conversions!

To convert a string to number like your example "2.78242e-03" you should use "%.;%f" as format string for "scan from string".
The same format string
"%.;%f" will give the desired result when using "Format into string" and a value of 0,002...

When changing system settings you have to restart LabView, not the whole (Windows) system...


Message Edited by GerdW on 04-02-2008 12:02 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 9
(6,243 Views)
Hai andreevz,
 
I tried the same with the given example. Its perfectly working without any problem for your first query. The thing is if u give a comma "," then it will just return the numbers before the decimal point. Here in this case it will give 2. If u give a dot "." then it will return the full value. That is result will be 0.00278242
 
Next, how u convert that value to a string? could u post ur code? so we will work it out easily.
 
Thanks and Regards,
Mathan
Message 8 of 9
(6,239 Views)

Thanks for all the responses people.

This forum is really great.

I already fixed the problem. I believe it was a problem with my regional settings, and when I change them and restarted LabView everything came in order. I am using the simplest functions you can find in LabView, such as convert string to fract/exp number, and convert fract number to string.

Thanks again. Later I will have more questions as I am building my first program by myself and up to now it is working almost fine 😉 

0 Kudos
Message 9 of 9
(6,236 Views)