Example Code

Convert 2D Array of Data to 1D Array of Waveforms

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.


  • Data Acquisition (DAQ)


  • LabVIEW


  • NI DAQmx

Code and Documents



This example converts the datatype of a 2D array of raw data into a 1D array of waveforms for use with 3rd party devices.



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.




  • LabVIEW 2012 or compatible
  • NI-DAQmx 9.5.5 or compatible


  • NI Multifunction DAQ Device


Steps to Implement or Execute Code

  1. Acquire Data in 2D Format.

  2. Take a time stamp at the first acquisition.

  3. Take each channel of the data and use the timestamp and t0 (inverse of the rate) to create a waveform.

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

Cont Acq&Graph.png

Block Diagram of Convert 2D to Waveform Array

Convert 2D.png

   **This document has been updated to meet the current required format for the NI Code Exchange.**

With warm regards,

David D.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.