Example Code

Write Single Data point Multiple Channels to TDMS using LabVIEW

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.

    Software

  • LabVIEW

Code and Documents

Attachment

1. Overview:

This VI stores the values in a 1D Array as single elements in multple columns in a TDMS File 

 

2. Description: 

When writing to a TDMS file, the TDMS VIs automatically log data grouped in channels according to the rows of a 2-D array. If attempting to write a 1-D array of data representing multiple channels, a conversion is required. This VI takes a 1-D array, builds a single row 2-D array and then transposes it, getting a multiple rows 1 column 2D Array. Then, this array is written in the TDMS file with each element of the original array corresponds to a single data-point in a new channel.

 

3. Requirements

  • LabVIEW 2012 (or compatible)

4. Steps to Implement or Execute Code

  1. Run the VI
  2. Select a file name and location
  3. In the file viewer, see that there are the same channel number than elements in the original array and that the elements in each channel correspond to the element in the original array.

 5. Additional Information or References 

VI Snippet

 

 snippet.png

 

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

PBear
NI RF

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

Comments
Maclean
Member
Member
on

Wouldn't this be more memory efficient if you put the 1D array into a single input build array and a transpose 2D array instead of indexing the loop outputs.

Maclean G.
Applications Engineering
National Instruments
NI Employee (retired)
on

Feel free to improve upon it!

PBear
NI RF
RSecrest
Member
Member
on

An example like this should be in the  LabVIEW Help Examples.

NASA_Goddard
Member
Member
on

This works great but I am having trouble writing this TDMS file out to a spreadsheet.   What is the trick ?