LabWindows/CVI

TDMS_AddChannel

int TDMS_AddChannel (TDMSChannelGroupHandle channelGroup, TDMSDataType dataType, const char *name, const char *description, const char *unitString, TDMSChannelHandle *channel);

Purpose

Adds a new channel to a channel group. A valid channel group should contain one or more channels.

Parameters

Input
Name Type Description
channelGroup TDMSChannelGroupHandle The handle of the channel group that will contain the new channel.
dataType TDMSDataType The data type of the new channel. The data for this channel must match the specified data type.

If you choose TDMS_Timestamp as the data type of a new channel, you must use the CVIAbsoluteTime type when you read or write data to that channel. You can use this type with TDMS_AppendDataValues and TDMS_GetDataValues. Refer to the Absolute Time functions in the Utility Library for more information about this data type.
name const char * The value of the Name property of the channel object. This property is stored in the channel and can be accessed with the TDMS_SetChannelProperty and TDMS_GetChannelProperty functions.
description const char * The value of the Description property of the channel object. This property is stored in the channel and can be accessed with the TDMS_SetChannelProperty and TDMS_GetChannelProperty functions.
unitString const char * The value of the Unit String property of the channel object. This property is stored in the channel and can be accessed with the TDMS_SetChannelProperty and TDMS_GetChannelProperty functions.
Output
Name Type Description
channel TDMSChannelHandle The handle for the requested channel. Pass this handle to other TDM Streaming Library functions that require a channel.

LabWindows/CVI automatically discards this handle when you close the containing file handle with TDMS_CloseFile. To discard the channel handle explicitly, call the TDMS_CloseChannel function.

Return Value

Name Type Description
status int Return value indicating whether the function was successful. Unless otherwise stated, zero represents successful execution and a negative number represents the error code.

Error codes are defined in cvi\include\cvitdms.h.

Additional Information

Library: TDM Streaming Library

Include file: cvitdms.h

LabWindows/CVI compatibility: LabWindows/CVI 8.1 and later

© 2016 National Instruments. All rights reserved.

Examples

Refer to the following examples that use the TDMS_AddChannel function:

  • TDM Streaming\tdmsWriteBenchmark.cws

    Open example
  • TDM Streaming\Advanced Read and Write\TDMS Advanced Async Write\TDMS Advanced Async Write.cws

    Open example
  • TDM Streaming\Advanced Read and Write\TDMS Advanced Async Write Throughput Test\TDMS Advanced Async Write Throughput Test.cws

    Open example
  • TDM Streaming\Advanced Read and Write\TDMS Advanced Sync Write\TDMS Advanced Sync Write.cws

    Open example
  • TDM Streaming\Advanced Read and Write\TDMS In Memory Write and Read\TDMS In Memory Write and Read.cws

    Open example