07-22-2016 04:23 PM
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?
Thank you so much!
Solved! Go to Solution.
07-22-2016 05:04 PM
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
07-25-2016 08:12 AM
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!)
07-25-2016 08:15 AM
Sorry, it's early. Here's my VI.
07-25-2016 09:21 AM
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.
Thanks for the attempt!
07-25-2016 03:46 PM
You can use "number to fractional string", it supports arrays.
07-25-2016 04:25 PM
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
07-25-2016 04:58 PM
@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.