12-02-2011 08:51 AM
Hi, I have a problem trying to convert an array of decimal numbers into a string with scientific notation numbers. I have this array of decimal numbers: {0 | 0,1 | 0,2 | 0,3 | 0,4 | 0,5 | 0,6 | 0,7 | 0,8 | 0,9 | 1 | 1,1 ...}
I convert the decimal number into a string with the function "Array to spreedsheat string", and converting the decimal number into scientific notation number; so i expect in the output something like this; {0 | 1E-1 | 2E-1 | 3E-1 | 4E-1 | 5E-1 | 6E-1 | 7E-1 | 8E-1 | 9E-1 | 1E-0 | 11E-1 ...}
The problem is that i can't have any decimal number in the scientific notation number so i use "%3.0e" to set the format, but at the output i get this: {0 | 1E-1 | 2E-1 | 3E-1 | 4E-1 | 5E-1 | 6E-1 | 7E-1 | 8E-1 | 9E-1 | 1E-0 | 1E-0 | 1E-0 | 1E-0 ...}
So, when my decimal number is 1.1 i get 1E-0 instead of 11E-1. When the decimal number is 1,5 i get 2E-0 as scientific notation format. ¿How can i have at the output 11E-1 or 15E-1?
Thankyou very much
12-02-2011 11:34 AM
Hi,
I'm not sure if this is what you're looking for but maybe it will help
set a reference to Imports System.Globalization
Dim value As Double = 1.1 Debug.WriteLine(value.ToString("0,#E+0", CultureInfo.CurrentCulture)) value = 0.1 Debug.WriteLine(value.ToString("0,#E+0", CultureInfo.CurrentCulture)) value = 1.5 Debug.WriteLine(value.ToString("0,#E+0", CultureInfo.CurrentCulture)) value = 11.5 Debug.WriteLine(value.ToString("0,##E+0", CultureInfo.CurrentCulture)) Debug.WriteLine(CultureInfo.CurrentCulture.ToString)
output
11E-1
10E-2
15E-1
115E-1
en-US
Curt
04-18-2014 09:12 AM
Dear Curt,
I have the same problem in LabVIEW. I knew can use Format Into String function. Can you please help me, how to use it? Thank you!
B/R
Ancle