Sie sind auf Seite 1von 3

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 Downloads container on the right side of this page.
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.
1. Open Record Failure Points.vi from Saving Data to File.lvproj. This VI includes a prebuilt UI, signal simulation, and limit
testing that determines if the generated signal is within a specific 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

2. First, add a Write to Measurement File Express VI to the Block Diagram. Right-click on the white space in the Block Diagram
1/3 www.ni.com
2. 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 File I/O Write to Measurement File. Click to place the VI on your diagram.

Figure 2: Navigate to the Write to Measurement File VI


3. 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 OK
when you have configured the Express VI.

Figure 3: Configure the Write to Measurement File Express VI


4. 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.

2/3 www.ni.com
Figure 4: Finished Block Diagram to record limit testing data
5. Test your code. Switch to the Front Panel and click the Run Arrow to run the application. You will be prompted to select a
location to save your Excel data. Give your file a name, and click OK. Run the VI for a few seconds, and move the Inject Noise
slider up and down to make sure you record some failure points. When you are finished, click the Stop button on your Front
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.

Figure 5: View results of the limit test in Excel


You can find the completed VI in the Solutions Folder in the Saving Data to File.lvproj LabVIEW project.
Learn more about saving data to file and reporting data using LabVIEW, including how to save data to a database.

3/3 www.ni.com

Das könnte Ihnen auch gefallen