From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Adding Test Information Header to a Text File in LabVIEW

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 example shows how to add some useful header information to a text file, when the file is first created. The application proceeds to stream all test data to the file.

This VI is useful because creates a header with some common test information. The header information produced by this example includes (Start Date | Start Time | Sample Rate and delta T (time between samples).

 

Description

The VI Main uses 4 instances of subVI Format File Property, this subVI is formatting a File Property Name and a File Property Value.

Then using File IO API VIs to Open the File, Write the Header for that File and Write the Simulated Signal (from Simulated Signal VI Express). on it.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Run Main VI (Create txt file header Main 2012 NIVerified.vi)
  2. Provide a .txt file location when prompted
  3. Simulated Data and headers are written to the text file until the VI is stopped

Additional Information or References

 9854 Snippet.png

 

 

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

 

Rich Roberts
Senior Marketing Engineer, National Instruments
Connect on LinkedIn: https://www.linkedin.com/in/richard-roberts-4176a27b/

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