01-25-2012 07:58 AM
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.
01-25-2012 08:17 AM
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%.
01-25-2012 08:21 AM
Whoops. Minor bug found.
Revised VI is attached.
01-25-2012 08:57 AM
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?
01-25-2012 11:08 AM
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.