LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Performance when writing a large 2D DBL array to a spreadsheet file

Thanks again, Questionmaker.  You and I are on the same page here.  I also did some quick testing to search for expressions.  But using regular expressions really slows it down.

 

However, I came up with a good solution.  I will post in a few minutes.

http://www.medicollector.com
0 Kudos
Message 11 of 15
(888 Views)

Attached is my proposed solution to this challenge.

 

It basically converts the large DBL array to a spreadsheet string at a fixed precision, then does a series of "search & replace" operations to remove all the trailing zeros.

 

Total time = 10 seconds on my PC!

 

BTW:  I am actually concerned about the trailing zeros because of the disk space they occupy.  Not just because it looks pretty.  You'd be surprised how much disk space is conserved when a TXT file can be written without all those useless trailing zeros.  It can often cut the file size by 50%.

http://www.medicollector.com
0 Kudos
Message 12 of 15
(885 Views)

Whoops.  Minor bug found.

 

Revised VI is attached.

http://www.medicollector.com
Message 13 of 15
(883 Views)

yes, 11.5 seconds on my computer - looks really good (:

I personally think that diskspace is cheaper than even my salary - and the most quick and dirty solution for this could be .zip archives.

On a sidenote, If you want to save more diskspace, transpose the data - each return takes up two bytes, instead of one like the tab. This creates more data than one might think.

 

One question still remains, though: Could a NI Developer tell us why this format string takes such a stupid amount of computation time?

 

Message 14 of 15
(878 Views)

Questionmarker wrote:

One question still remains, though: Could a NI Developer tell us why this format string takes such a stupid amount of computation time?


I'm not an NI developer, but... seems like one of those cases where a programmer thinks a library function isn't fast enough simply because it doesn't execute as fast as he would like.  Try writing the code for this yourself and see how much work it is!  Remember that with automatic formatting you need to handle exponents (scientific notation), determine the right number of decimal places, allocate a string, convert the numeric value to individual characters - it's not trivial, and it does it for every single value.

Message 15 of 15
(868 Views)