LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digits of precision in Excel Easy Table

Solved!
Go to solution

Hi all,

 

I am trying to dump a lot of data into an excel file for viewing that is not displayed on any waveform charts on the front panel of my VI, and I've used the Excel Easy Table vi to do so. I dropped a probe on the 2D array to be exported just before it goes into the 'text data' input of the VI and it has between 2 and 8 digits of precision showing up (which is what I want), but it is shortened to only 3 when the excel file is filled. Is there any way I can export the data so that it won't truncate the numbers?

export.png

Thank you so much!

0 Kudos
Message 1 of 8
(4,950 Views)

It is too bad you didn't attach your VI (instead of a hard-to-read Snippet) -- it would be easier (for us, the people trying to help you) see what you are doing.

 

I think the problem is that There Is No Problem!  Since you are writing Dbls into the Excel Array, what Excel actually has is its internal representation of Floats, which it is (probably by default) displaying with three figures.  Try changing the Format properties for the cell -- the data should all be present.

 

Bob Schor

0 Kudos
Message 2 of 8
(4,945 Views)

My whole VI is pretty unnecessary to attach, I was just trying to show which excel VIs I was using, but here it is anyway. 

 

Also yes, I did try changing the cell format and the data is not there. Zeroes are present past the third digit of precision. 

 

(And what's with the new forum layout?? Change is scary ahh!)

0 Kudos
Message 3 of 8
(4,884 Views)

Sorry, it's early. Here's my VI.

0 Kudos
Message 4 of 8
(4,881 Views)
Solution
Accepted by topic author try_guy90

Found a solution! The problem was that I had the 2D array wired directly to the text data input. I used a nested for loop and a Format into String vi with the string format set to %.7f, indexing in and out of the loops. It works beautifully. 

loops.png

 

Thanks for the attempt!

0 Kudos
Message 5 of 8
(4,872 Views)

You can use "number to fractional string", it supports arrays.

Message 6 of 8
(4,863 Views)

You know, I didn't believe you, so I did my own test, creating a 2D array of Dbls and writing it to Excel using Excel Easy Table.  Guess what -- you are Absolutely Correct!  When you pass Numeric Data into the Easy Table function, the data ("mis"-identified as Text Data) gets passed to a polymorphic sub-VI designed to work with numeric data.  As it happens, this function does the Numeric to String conversion (not really sure why), using a default Format Spec of %.3f.  However, the Format specifier is never brought "up" to the user to let him/her specify it in case additional precision is necessary.

 

Frankly, it makes no sense to me why, if LabVIEW needs to write text, it can't use a default Format of %.15f, and allow Excel to show however much precision the user wants, but to preserve it when writing to the file.  I briefly tried to fix this, myself, but it is buried sufficiently far down that I didn't want to mess with it ...  I'll put it up on the Idea Exchange.

 

Bob Schor

Message 7 of 8
(4,850 Views)

@Bob_Schor wrote:

Frankly, it makes no sense to me why, if LabVIEW needs to write text, it can't use a default Format of %.15f,

 

Bob Schor


I'd say I don't want all those extra zeroes written to the text file if I only need 3 or 6 or however many digits of precision.

0 Kudos
Message 8 of 8
(4,844 Views)