Main Content

tdmswriteprop

Write properties to TDMS-file

Since R2022b

Description

With the tdmswriteprop function you can write file properties, channel properties and channel group properties to a TDMS-file.

example

tdmswriteprop(tdmsfile,propname,propvalue) writes file property names and corresponding values to the specified TDMS-file. You can set a single property or multiple properties. To set multiple properties, use arrays to specify property names and values. With tdmswriteprop you can specify and modify existing properties, or add new properties.

tdmswriteprop(tdmsfile,propname,propvalue,ChannelGroupName=chGrpName) and tdmswriteprop(tdmsfile,propname,propvalue,ChannelGroupName=chGrpName,ChannelName=chName) specify the existing channel group or channel that the property is assigned to. You can set the properties of only one channel or channel group at a time.

Examples

collapse all

Write the title file property of a TDMS-file.

tdmswriteprop("sinewave.tdms","title","Measurement Data")

Write a channel group description property of a TDMS-file.

tdmswriteprop("sinewave.tdms","description","Amplitude and Phase Sweep",...
    ChannelGroupName="ChannelGroup1")

Write a channel property of a TDMS-file.

tdmswriteprop("sinewave.tdms","max_value", max(data), ...
    ChannelGroupName="ChannelGroup1", ChannelName="Amplitude Sweep")

Write two properties of a channel.

tdmswriteprop("sinewave.tdms",["max_value" "min_value"],[max(data),min(data)] ...
    ChannelGroupName="ChannelGroup1", ChannelName="Amplitude Sweep")

Input Arguments

collapse all

TDMS file name, specified as a string or character vector.

For local files, use a full or relative path that contains a file name and extension. You also can specify a file on the MATLAB® path.

Example: "sinewave.tdms"

Data Types: char | string

Property name, specified as a string or character vector. When writing multiple properties, use an array of strings to identify them. To create custom properties, specify a name that does not already exist.

Example: "title"

Data Types: char | string

Property value, specified as a supported type for its property. To set multiple properties, use an array of values. If the values are different types, for example numeric and string, use a cell array.

Example: {"Input Channel",2.0,"mV"}

Channel group name, specified as a string or character vector.

Example: "ChannelGroup1"

Data Types: char | string

Channel name, specified as a string or character vector.

Example: "Amplitude sweep"

Data Types: char | string

Version History

Introduced in R2022b

See Also

Functions