Example Code

Extract Column from Text File

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

This VI extracts a chosen column of data from a tab-delimited text file and then save it to a different text file.

 

Description

This program uses the Read from Text File VI with the Spreadsheet String to Array VI to read in a text file and convert it to an array of strings.  The Index Array VI is then used to pick out the column that the user selects.  Finally, the column is written to a new text file using the Write to Spreadsheet File VI.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Provide the file path to the text file you would like to read
  2. Provide the file path to the output text file you would like to save
  3. Select the column you would like to extract
  4. Run the VI

 

Additional Information or References

 snippet2.PNG

 

VI Snippet 

1 (2).png

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Vivek Nath
National Instruments
Applications Engineer
Machine Vision

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