How to Apply Column-Specific Decimal Formatting When Exporting 2D Arrays to CSV in LabVIEW?

Updated Aug 11, 2025

Environment

Software

  • LabVIEW

This articles overlines the steps to customize number or decimal points for each column when converting an array to a spreadsheet string in LabVIEW and exporting the results as a CSV file.

Follow the steps below to implement column-specific decimal formatting in LabVIEW:

  1. Prepare the 2D array that contains your measurement data. 
  2. Create a subVI that accepts a 1D array (representing a single column) and a format string as inputs. This subVI should return a formatted string for that column.

     
  3. Use the Index Array function to extract each column from the 2D array.
  4. Call the subVI for each column individually, passing a different format string depending on the required decimal precision. For example:
    - Column 1 (1 decimal point): %.1f
    - Column 2 (1 decimal point): %.3f
    - Column 3 (2 decimal point): %.2f
  5. Combine the formatted strings using the Insert Into Array function.
  6. Use the Array to Spreadsheet String function to convert the final array into a spreadsheet-compatible string.
  7. Save the result as a .csv file using the Write To Text File function.