09-25-2015 04:21 AM
I want use write to measurement file to write data from my instrument with 9 digits of precision. but output of Write to Measurement have only 6 digits. here is simple example
09-25-2015 04:24 AM - edited 09-25-2015 04:25 AM
Hi VMI,
I cannot open your LV2015 VI, but most WriteMeasurement functions have an input to specify the format.
What does the help for the function tell you about this topic?
09-25-2015 04:51 AM
09-25-2015 07:41 AM
Wow that really sucks. Just another reason I hate using those express VIs. For those without 2015 it is just one Write to Mesurement File express VI configured to write as an XLSX file. If you convert the express VI to a normal VI you can open the source, but boy will you be confused. Many nested layers, and overly complicated code in my opinion. It appears the limitation comes from a constant on the block diagram, stating how to convert floating point numbers to strings. The format defined for an array of doubles is %.;%f and can be found in:
vi.lib\express\express shared\NI_ExcelFile\SubVIs\rd_initialFormat.vi
I would not recommend changing this, because you would be editing system VIs but for completness I thought I mention where it comes from.
Unfortunatly there is no easy work around for this. This same limitation is set on DDT, and Waveform data types. And this function doesn't support writing strings. If it did you could do the conversion yourself and tell it to write the string. You are either going to have to live with the limitation, apply a scaling factor (say multiply all numbers by 1000), or write your own file logging functions, and logging to XLSX will require a toolkit of some kind, CSV would be trivial.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
09-25-2015 08:41 AM
Before you rip the LabVIEW apart, are you sure it isn't in the Excel?
If I open Excel and type 0.123456789 into a cell, it will initially display as 0.123457 until I increase the decimals.
Rod.
09-25-2015 08:51 AM - edited 09-25-2015 08:52 AM
I used the format into string with the format defined in the VI and it does round up after 6 decimal places. I also made a file as described by OP and set the cell formatting in Excel to be Numeric and to show 10 digits of precision, but it only showed the .1234570000 so I do believe this if how the file is being written and is a limitation of the express VI. Using the format of %.;%.9f would define 9 digits of precision.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
09-25-2015 10:53 AM
09-25-2015 11:27 AM
Writing data to a TSV or CSV with your desired resolution is very simple in LabVIEW. Look at Help > Find Examples... Fundamentals > File input and Output > Spreadsheet > Tab-Delimited Data.lvproj. That example has a very easy example of opening, formatting data, writing to file, and closing the file in the VI called Write Tab-Delimited File.vi. You will see that there is a format specifier that is set to %.3f (3 digits). That is what you have to change to %.9f. Dump the silly ExpressVIs and learn the primitives that have power that you can control. Format into File.vi and Format into string.vi are also your friends.