06-02-2008 10:56 AM
06-02-2008 11:31 AM
06-02-2008 11:44 AM
06-02-2008 12:03 PM
I'm not trying to make smaller files, I only want to save the accurate data.
If the thermocouple is only accurate to 0.3 degrees Celcius, what would be the point of saving 8 decimal places?
None of those last 7 are correct, that is why i am trying to get rid of them.
- Cory
06-02-2008 12:38 PM
06-02-2008 12:51 PM
Maybe I am mistaken about the precision of the thermocouple I am using,
But either way, could you help me figure out how to change the precision of a measured value.
It would be a valueable piece of information for me to know in the future.
Thanks,
Cory
06-02-2008 12:57 PM - edited 06-02-2008 01:01 PM
You are using Write to Measurement File which does not provide for a lot of flexibility. You could right click on it and select 'Open Front Panel'. This will convert it to a regular VI. You can dig down and find where the data is being formatted. I never use the Express VI so I don't know how deep you have to dig. As already mentioned, you can use the Write to Spreadsheet function. This gives you the ability to specify a format. The default is %.3f. Write to Spreadsheet File is using the Array to Spreadsheet function so you could also use this and the more primitive Write to Text File.
Another option is the Export Waveforms to Spreadsheet file. At the top level, you don't have the ability to specify a format but if you look at the block diagram, you will see that the Y array is converted to strings with the Number to Exponential String function. It uses a default of 6 for precision. This might be easier for you to modify than the Write to Measurement file. If you do modify it, be sure to save it with a new name and in a new location.
06-02-2008 01:00 PM
06-02-2008 01:00 PM
What exactly is %.3f?
Is that 3 decimal places or to the nearest 3/10?
- Cory
06-02-2008 01:10 PM
For functions that produce a string as an output, such as Format Into String and Array To Spreadsheet String, a format specifier uses the following syntax elements. Double brackets ( [] ) enclose optional elements.
%[$][-][+][#][^][0][Width][.Precision || _SignificantDigits][{Unit}][<Embedded information>]Conversion Code
where Width must be a number greater than zero and .Precision and _SignificantDigits must be a number greater than or equal to zero.
examples:
Type | Argument(s) | Format String | Resulting String | Comments |
---|---|---|---|---|
Automatic Formatting (%g) | 12.00 | %#g | 12 | If you specify #, LabVIEW removes trailing zeroes. If you specify g, LabVIEW chooses exponential notation or floating-point notation based on the number to format. |
12000000 | %#g | 1.2E+6 | ||
Decimal (%f) | 12.67 | score= %.0f%% | score= 13% | When you specify %f, LabVIEW rounds the argument. Use %% to format a single %. Use .0 to remove decimal. |
Floating-Point (%f) | 12.67 | Temp: %5.1f | Temp: 12.7 | The 5 in the Format String section specifies a width of 5, and the 1 specifies the number of digits to the right of the decimal, or precision. |
12.67 N | %5.3f | 12.670 N | Units are valid only if you use the Format Into String or Scan From String functions. These are examples of physical quantity input. The second example shows how you can convert from one unit to another. The question mark indicates when the unit in the format specifier is in conflict with the input unit. | |
12.67 N | %5.3{mN}f | 1267.000 mN | ||
12.67 N | %5.3{kg}f | 12.670 ?kg |