Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Way to select digits of precision when writing to file?

I am using the build array funtion to build an array from inputs that are double precision and have many digits of precision. After that I use the Array to Spreadsheet function to organized the data, then the spreadsheet is written to a text file using Write File. I need to know how I can cut down on the digits of precision that are being written to the text file. Now there are 5 digits of precision, but I only want 1.
0 Kudos
Message 1 of 4
(3,022 Views)
All you have to do is use a different format string. If you have something like %f wired to the format string input, change it to %.1f for one digit of precision.
Message 2 of 4
(3,018 Views)
I have one more question. I am reading an encoder using DAQ digital channels.  I am outputing what the encoder reads to a text file. I have precision at .1 and I need to coerce the values to be at intervals of .5. example if the number is 2.8 i want to see 3 in the file or if the number is 1.3 i want 1.5.
0 Kudos
Message 3 of 4
(2,984 Views)
Here's a cheap little algorithm that will do it. Just compare the number to its value when rounded to an integer and add either 0 or 0.5 accordingly to the integral value. This is written in LabVIEW 7.0, let me know if you need it in an earlier version.
Jarrod S.
National Instruments
0 Kudos
Message 4 of 4
(2,968 Views)