annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

Exponential String to Number

Should be easy...but I'm getting hung up here:
 
I am trying to convert strings in the form 1.40E00 to doubles in the form 1.400.  I am using the "Fract/Exp String To Number.vi", but it does not recognize the decimal values and returns only the integer values.  When I set precision past the decimal place, it returns 1.000 rather than 1.400.  Should be simple, but its kicking my behind.  Any quick fixes?
0 Kudos
Messaggio 1 di 13
9.550Visualizzazioni
OK...I'm replying to my own here because I just resolved one part of the question.  That is...I had the "number" output going straight into an array, and the array has the decimal problem, not the string-to-number vi.  I threw an indicater on the number output prior to the array input and it reads the decimal value correctly.  So it is the array that lops off anything past the decimal. 
0 Kudos
Messaggio 2 di 13
9.548Visualizzazioni
Could you post your code? It's probably just a simple formatting problem. right click the indicator you're having trouble with and go to "format & precision." You can set the number of significant figures or decimal places that are displayed. The internal representation of a DBL is always the same, but it sounds like you're just having a problem with how it is displayed.
0 Kudos
Messaggio 3 di 13
9.542Visualizzazioni

Here it is.  Thanks for looking this over.

- Mike

0 Kudos
Messaggio 4 di 13
9.539Visualizzazioni
That was the other possibility that I was thinking. You're using an array of integers. This needs to be an array of doubles. Also, you created the array with 0 elements, and you're inserting elements into it. You should initialize it with as many elements as you'll need, then use Replace Array Subset. I fixed it and attached the new VI.
0 Kudos
Messaggio 5 di 13
9.522Visualizzazioni
Mike,

The output array is I32. Change it to DBL along with the initialization.

It is ususally better to initialize an array to the desired langth and use replace array element rather that insert or build array.

Even easier is Spreadsheet string to Array with a %e format string.

Lynn
0 Kudos
Messaggio 6 di 13
9.520Visualizzazioni

Hi

 

i saw your post and found out that you have successfully been able to convert the exponential string to the decimal number. However, I've not been able to do it. So could you please help me out with it. I want the current values to be like 1.4528576, while now am only getting the integer values.

 

Thanks for the help.

 

0 Kudos
Messaggio 7 di 13
8.682Visualizzazioni

Either your input to the function is wrong, or your method of displaying the output is wrong, the fucntions works fine unless you can show it not working properly.

 

Please post an example of it not working, with inputs as a constant.

Messaggio 8 di 13
8.671Visualizzazioni

Sitank wrote:

i saw your post and found out that you have successfully been able to convert the exponential string to the decimal number. However, I've not been able to do it. So could you please help me out with it. I want the current values to be like 1.4528576, while now am only getting the integer values.


Please run your VI until the string array labeled "Current" contains 10 valid elements. Now right-click the "Current" terminal and select "create constant". Save under a new name and attach it again (and please give it a reasonable file name!) Now we have something to play with.

 

Could it be that the device uses a comma as decimal seperator? What is the language setting of your computer?

Messaggio 9 di 13
8.658Visualizzazioni

 

Thanks for the help, but am done with my issue... 😄

0 Kudos
Messaggio 10 di 13
8.618Visualizzazioni