Example Code

Add Titles to Rows in a Spreadsheet Array

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

The example demonstrates how to add row or column headers to a table and save the result to a ASCII file

 

Description

2D arrays in LabVIEW are organized that the first dimension resembles the rows and the second dimension resembles the columns of a table.

To add headers to every column you only have to add a row on top of the table, since the row is the first dimension you only have to use the 'Build Array' function.
In case you want to add a header to every row in a table, you first have to transpose the table with the 'Transpose 2D array' function (so rows and columns are switched) and then use the 'Build Array' function and the transpose the table again to reverse the first transpose operation.

 

Requirements

 Software

  • LabVIEW 2012 Base Development System (or compatible)

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. (Optional) Change the data for the column headers and the numeric array as well as the path
  2. Select the mode to add the header either to the columns or the rows
  3. Run the VI

 

Additional Information or References

Add headers to row or column of a 2D array LV2012 NIVerified.vi - Front Panel.png

 

Add headers to row or column of a 2D array LV2012 NIVerified.vi - Block Diagram.png

 

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text 'NIVerified'. Read here for more information about the new Example Guidelines and Community Platform.**

Jared S.
Applications Engineering
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.