Anda di halaman 1dari 3

1/3 www.ni.

com
1.
2.
LabVIEW Evaluation Series: Saving Data to File
Publish Date: May 13, 2014
Overview
There are several options to save and report your measurement data in LabVIEW. Whether you want to log data to a file, save data to a database, or programmatically decide what to do based on
an operator decision or the conditions of your measurement, LabVIEW has the functionality you need. This guide will show you how to record limit testing results to an Excel file using LabVIEW.
1. Before You Begin: Download Sample Code
This guide includes sample code. You can access it from the container on the right side of this page. Downloads
2. Quickly Save Data with the Write to Measurement File Express VI
Saving data is simple with the Write to Measurement File Express VI. You can use this function to configure how you'd like to save your data, and it supports multiple file formats including TDMS,
LabVIEW Measurement files, and the Excel file format.
Open from . This VI includes a prebuilt UI, signal simulation, and limit testing that determines if the generated signal is within a specific Record Failure Points.vi Saving Data to File.lvproj
range. In this guide, youll add the code to save the limit test results to an Excel file.
Figure 1: Starting point for recording failure points
First, add a Write to Measurement File Express VI to the Block Diagram. Right-click on the white space in the Block Diagram and navigate to . Click to File I/O Write to Measurement File
place the VI on your diagram.
Figure 2: Navigate to the Write to Measurement File VI
2/3 www.ni.com
2.
3.
4.
5.
Figure 2: Navigate to the Write to Measurement File VI
Configure the Write to Measurement File Express VI to prompt the user to specify a file, rename the file if it already exists, and save to .xlsx format so you can open the data in Excel later.
The configured window should look like Fig. 3 below. Click when you have configured the Express VI. OK
Figure 3: Configure the Write to Measurement File Express VI
On the Block Diagram, connect the Tested Signals output of the Mask and Limit Testing Express VI to the input of the Write to Measurement File Express VI. Your finished Block Diagram
should look like Fig. 4 below.
Figure 4: Finished Block Diagram to record limit testing data
Test your code. Switch to the Front Panel and click the to run the application. You will be prompted to select a location to save your Excel data. Give your file a name, and click Run Arrow
. Run the VI for a few seconds, and move the slider up and down to make sure you record some failure points. When you are finished, click the button on your Front OK Inject Noise Stop
Panel to stop the application running. Browse to the location you saved your data file, and open it in Excel. You should see four columns of data - the value of the square wave, the failure
points (if the data point was within the limits it passed, and you'll see a value of #NV), and finally the upper and lower limits the test was comparing against.
3/3 www.ni.com
5.
Figure 5: View results of the limit test in Excel
You can find the completed VI in the in the LabVIEW project. Solutions Folder Saving Data to File.lvproj
Learn more about saving data to file and reporting data using LabVIEW, including how to save data to a database.

Anda mungkin juga menyukai