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, use LabVIEW to customize and automate the saving and recording of measurement data.
Quickly save measurement data 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 Record Failure Points.vi from Saving Data to File in the Measure Physical Systems with Sensors or Actuators sample project. 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, you’ll 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 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.
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.
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 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.
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.