To download NI software, including the products shown below, visit ni.com/downloads.
The Waveform to 2D Array polymorphic VI will convert any single waveform or 1D array of waveforms to a 2D array of doubles. The resulting array will have time information in the first column, indexed according to the timing of the first waveform. This instance could easily be modified to provide a different method for this conversion, such as having individual time columns for each waveform/channel.
This function works by stepping through the array of waveform data, getting the waveform components dt (time difference between samples) and Y (amplitude of sample), then auto-indexing through the array using a for loop. Inside this loop, a 2-D array is built, again using auto-indexing. This new array contains time data in the first column, calculated by multiplying the dt of the waveform with the iteration of the for loop. Subsequent columns contain waveform amplitude data; there will be one additional column for each waveform in the initial array of waveforms.
LabVIEW 2012 (or compatible)
Steps to Implement or Execute Code
1. Download and unzip the Waveform to 2D Array LV 2012 NI Verified ZIP folder.
2. Place the unzipped files into the directory for your project.
3. Add the files into your project (In Project Explorer window, right-click on My Computer, select Add»File...).
4. Add the Convert Waveform to 2D Array LV 2012 NI Verified.vi sub-VI into the VI where you plan to use the function.
5. Wire either a single waveform or an array of waveforms into the VI. Because the function is polymorphic, it will automatically select the Single or Multiple Waveforms instance based on the data you wire in.
Additional Information or References
Single Waveform Instance Block Diagram:
Multiple Waveform Instance Block Diagram:
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.