Acquiring data is the first step in performing an experiment, but the data is lost if it is not recorded. This is where computer-based data logging is useful. Data logging allows for every point of data acquired by the DAQ device to be recorded to a measurement file for later review. This module introduces you to data logging in NI LabVIEW software.
Before starting this procedure, you should complete the exercise and use the solution in the Taking a Measurement module. You can also create a numeric control to simulate the data acquisition input.
Add the Write to Measurement File Express VI to the block diagram
Right-click on the block diagram and select Express»Output»Write To Measurement File
Place the Write to Measurement File Express VI to the right of the DAQ Assistant, within the While Loop
Configure the Write to Measurement File Express VI
Enter the Filename as desired; select the Browse icon if preferred
Specify the File Formatas desired; in this example Binary (TDMS) is selected
Choose which Action to take if the Filename already exists; in this example Append to file is selected
Specify the Segment Header type as desired; in this example only one header is created for the entire log file that is composed of multiple data sets
Specify the X Value Columns as desired; in this example there is One column only for the time columns
Provide a File Description to help identify the data set if desired
Wire the data from the DAQ Assistant into the Signalsinput of the Write to Measurement File Express VI
Run the VI to visualize the data on the front panel as well as log data to the file
Read the Binary TDMS log
Use the Read from Measurement File Express VI located by right-clicking on the block diagram and selecting Express»Input»Read from Measurement File
Use the TDMS plug-in with Microsoft Excel to open the file by opening Excel, selecting the Add-Ins pane, selecting the TDMS Importer button, and browsing to the Filepath(the data is located on the second worksheet tab of the Excel document)
Right-click on the above VI snippet and select Save Image As... Locate the file on your hard disk and click and drag the file icon onto your LabVIEW block diagram. LabVIEW automatically generates the code from the VI snippet. For more information, read VI Snippets.
Prompt the user for a filename after the run button has been pressed by using the File Dialog Express VI. This allows the user to choose where to place the data log. Before starting this exercise, you should complete the exercise and use the solution in the Taking a Measurement module.
Things to Consider
Search for the File dialog in the Functions palette search bar to locate this VI.
This VI has a configuration window. Do you want to allow for multiple selections? Do you want to allow for folders, too? Do you want to allow for new files, existing files, or both?
Should this be placed inside or outside the While Loop? Consider what happens to any VI placed within the While Loop.
Does the File dialog allow for any other customization?
Evaluate your understanding of LabVIEW and the basics of DAQ. This exam is recommended after you complete all of the modules for LabVIEW Basic Concepts and LabVIEW Basic Tasks. There are 26 multiple choice questions on the exam.
Assess your working knowledge of building a complete system by acquiring, processing, and displaying data with LabVIEW and a DAQ device. This project is recommended after you complete all of the modules for LabVIEW Basic Concepts and LabVIEW Basic Tasks.