To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This example converts the datatype of a 2D array of raw data into a 1D array of waveforms for use with 3rd party devices.
Description
In LabVIEW, the waveform data type is a very useful tool because of the timing information included. The National Instruments Data Acquisition Driver (NI-DAQmx) offers the option to acquire data in waveform format (1 channel) or a 1D Array of Waveforms (multiple channels). However, there are some 3rd party devices which do not offer this functionality and instead you can only acquire a 2D Array.
Since it would be beneficial to have the timing information I have built a VI which takes the 2D Array of Data and converts it to a 1D Array of Waveforms which you can then view on a Waveform Graph/Chart, save to view later, or use for analysis.
Note that while this example was written using NI-DAQmx, if you are using NI DAQ cards you should use the built-in functionality of the DAQmx driver which is included with that hardware and you should not convert using this VI. You should only use this VI if you are using 3rd party hardware which does not natively support a waveform format. The reason is that this timestamp is not as accurate as a driver timestamp because it is a software timestamp and depends on Windows (which is not deterministic). Therefore using these VIs you will have an offset on your timestamp from the actual acquisition time.
Requirements
Software
Hardware
Steps to Implement or Execute Code
Acquire Data in 2D Format.
Take a time stamp at the first acquisition.
Take each channel of the data and use the timestamp and t0 (inverse of the rate) to create a waveform.
Use a for loop to auto-index the data and build an array.
Additional Information or References
To reiterate, do not use this VI with NI hardware, this VI is a workaround for 3rd party drivers which do not natively support the waveform data type.
Block Diagram of Cont Acq&Graph Voltage-Int Clk Make Waveform from 2D
Block Diagram of Convert 2D to Waveform Array
**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.