TDMS Read Function

Owning Palette: TDM Streaming VIs and Functions

Requires: Base Development System

Reads the specified .tdms file and returns data in a format specified by the data type input. If data has scaling information, this VI automatically scales the data. Use the count and offset inputs to read a specified subset of the data.

Examples

 Add to the block diagram  Find on the palette
count specifies the maximum number of data elements to read from the .tdms file for each channel. The default is –1, all available elements.
offset specifies the number of data elements into the .tdms file at which the function begins reading the .tdms file. The default is 0.
tdms file specifies a reference number to the .tdms file on which to perform the operation. Use the TDMS Open function to open the refnum.
group name in specifies the channel group on which to perform the operation. If you do not wire data to this input, the following behavior occurs:
  • LabVIEW reads data from the current group in the file. The current group is either the first group in the file when you run this function for the first time or the nth group at the nth cycle when you run this function continuously for multiple cycles.
  • The order that the TDMS Read function reads groups is the same order that the TDMS List Contents function returns groups.
  • After LabVIEW reaches the last group, if the TDMS Read function attempts to run, LabVIEW returns an end of file error.
Note  The TDMS List Contents function and the TDMS Get Properties function will reset the current group to the first group in the file. Resetting the current group to the first group in the file impacts the group read by the next TDMS Read function when you do not wire the group name in input.
channel name(s) in indicates the channel to perform the operation on. If you do not wire data to this input, LabVIEW reads data from all channels under the same group. If you wire waveform data to the data type input, LabVIEW uses waveform names. The data type that the channel name(s) in input accepts can be a string or a 1D array of strings. The data type varies according to the data you wire to the data type input.

String 1D Array of Strings
Analog waveform

1D array of:
  • Signed or unsigned integers
  • Floating-point numbers
  • Timestamps
  • Booleans
  • Alphanumeric strings that do not contain null characters
Digital waveform

Digital table

1D array of analog waveforms

2D array of:
  • Signed or unsigned integers
  • Floating-point numbers
  • Timestamps
  • Booleans
  • Alphanumeric strings that do not contain null characters


If you load a complete file or group that contains compressed digital data, LabVIEW automatically inserts the compression channel name in the channel name(s) in array. If you load a subset of a file or group that contains compressed digital data, you must enter the name of the compression channel as the first entry in the channel name(s) in array.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
data type is the type of data that you want data to contain. This input accepts the following data types:
  • Analog waveform or a 1D array of analog waveforms
  • Digital waveform
  • Digital table
  • Dynamic data
  • 1D or 2D array of:
    • Signed or unsigned integers
    • Floating-point numbers, including the following specific data types:
      • Single-precision and double-precision floating-point numbers
      • Complex single-precision and double-precision floating-point numbers
      • (Windows) Extended-precision floating-point numbers
    • Timestamps
    • Booleans
    • Alphanumeric strings that do not contain null characters
return channels in file order? specifies whether this function returns data channels in the same order as they exist in the .tdms file. If the value is TRUE or if you do not specify the channel name(s) in input, this function returns data channels in the same order as they exist in the .tdms file. If the value is FALSE, this function returns data channels in the same order as you specify in the channel name(s) in input. The default is FALSE.
tdms file out returns a TDMS file reference to the .tdms file on which you performed the operation.
group name out returns the name of the channel group on which you performed the operation.
channel name(s) out returns the channel name on which you performed the operation.
data contains the data read from the file in the specified data type. It can consist of any data type depending on which data type you specify in data type and how count is set.
error out contains error information. This output provides standard error out functionality.
end of file? indicates if the end of the file has been reached.

Examples

Refer to the following VIs for examples of using the TDMS Read function: