LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get leading zeroes in exponent of e-format

In order to mimic an ancient file specification, am trying to write DBL numbers in e-format where the exponent is padded to two digits with leading zeroes.
 
For example:  -1.15091E-03
 
Is there a simple format code that does this or do I need to write something from scratch?
Message 1 of 4
(2,782 Views)

Hi Altenbach,

Are you writing the numbers to an indicator or a file?

Ipshita C.

National Instruments
Applications Engineer
Message 2 of 4
(2,741 Views)

I am writing to a file.

(Currently, I use the following workaround: format as %12.5e, then scan the substring after the "E", format it as %+03d, and recombine with the mantissa)

Message 3 of 4
(2,737 Views)
Hi Altenbach,
 
What you require is parsing the bits in your number to put them in your desired format. LabView does not have any parsing functions that can output in the format that you want. You can do the parsing in a dll written in C where you enforce the display of the mantissa and exponent and then call that in LabView using a Call Library Function Node. Hope this helps.
 
Ipshita C.
National Instruments
Applications Engineer
Message 4 of 4
(2,697 Views)