LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Data to Excel

In my labview application I pass some data (1D array of singles, the values
are very small, such as 0.000000345, etc) to excel. However, when I looked
at the data in the excel worksheet, all the data I had passed were modified
to something like, 7.53E-0.5 and some other values. I tested my vi with
larger values and the data were ok. Does anyone know what happened here?

any suggestion are welcome.

thank you,

-Joe

btw, I am using LV 5.1
0 Kudos
Message 1 of 3
(2,755 Views)
Hi Joe.

In Excel, data display formatting is separate from data values. If
you write
to a new sheet, all cells will be formatted as GENERAL. Excel will
then try to
display each cell most appropriately for the contents. Your
0.000000345 is a
waste of display space, so Excel uses the scientific format of
3.45E-07 which
is more compact. If you want the formatting a certain way you will
have to
format the cells as FIXED to 9 or more digits. The VBA code would be:

Range("DataBlock").NumberFormat = "0.000000000"

- Michael
--
Michael Munroe Mailto:mmunroe@abcdefirm.com
A Better Complete Development Engineering Firm
San Mateo, CA 94403 http://www.abcdefirm.com

"Joe Y. Guo" wrote:

> In my labview application I pass some data (1D array of singles, the values
>
are very small, such as 0.000000345, etc) to excel. However, when I looked
> at the data in the excel worksheet, all the data I had passed were modified
> to something like, 7.53E-0.5 and some other values. I tested my vi with
> larger values and the data were ok. Does anyone know what happened here?
>
> any suggestion are welcome.
>
> thank you,
>
> -Joe
>
> btw, I am using LV 5.1
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 2 of 3
(2,755 Views)
I fixed the problem by passing the value not as a scalar but as a 2-D array (only 1 element). I used 2-D array because I have this VI doing it. Maybe a 1-D array works too.

Joe
0 Kudos
Message 3 of 3
(2,755 Views)