Main Content

tdmsreadprop

Read properties as single row table from TDMS file

Since R2022a

Description

example

props = tdmsreadprop(tdmsfile) returns a table of properties from the specified TDMS file.

props = tdmsreadprop(tdmsfile,Name=Value) uses name-value pairs to filter the information to get specific properties.

Examples

collapse all

Read the file level properties of a TDMS file.

props = tdmsreadprop("Turbine_003.tdms")
props =

  1×7 table

        name              title         author                        description                                   datetime                datestring     timestring
    _____________    _______________    ______    ____________________________________________________    _____________________________    ____________    __________

    "Turbine_003"    "Turbine Tests"    "xyz"     "Test the Acceleration, Force and Torque of Turbine"    2021-10-18 01:57:17.000000000    "10/18/2021"    "11:27:17"

Read the properties of one channel group.

props = tdmsreadprop("Turbine_003.tdms",ChannelGroupName="Torque")
props =

  1×2 table

      name      description
    ________    ___________

    "Torque"    "CGTorque"

Narrow the scope to view properties specific to a channel. Note that in this case, a channel has more properties than its channel group does.

props = tdmsreadprop("Turbine_003.tdms",ChannelGroupName="Torque",ChannelName="Torque2")
props =

  1×19 table

      name        datatype        description       unit_string    displaytype        monotony           novaluekey       ResultStatArithMean    ResultStatMax    ResultStatMin    ResultStatSqrMean    ResultStatSum    wf_increment    wf_samples    wf_start_offset            wf_start_time            wf_time_pref    wf_xname    wf_xunit_string
    _________    ___________    ________________    ___________    ___________    ________________    ________________    ___________________    _____________    _____________    _________________    _____________    ____________    __________    _______________    _____________________________    ____________    ________    _______________

    "Torque2"    "DT_DOUBLE"    "from Clipboard"       "Nm"         "Numeric"     "not calculated"    "not calculated"        -6.7843e-06           1.4651           -1.6662            0.12794            -2.2049          0.0001          3312              0           2012-07-31 18:00:00.000000000     "relative"      "Time"           "s"      

Filter on specific properties of the file.

props = tdmsreadprop("Turbine_003.tdms",PropertyNames=["name" "title" "author" "description"])
props =

  1×4 table

        name              title         author                        description                     
    _____________    _______________    ______    ____________________________________________________

    "Turbine_003"    "Turbine Tests"    "xyz"     "Test the Acceleration, Force and Torque of Turbine"

Retrieve the start time and step period for a channel.

props = tdmsreadprop("Turbine_003.tdms",ChannelGroupName="Torque",ChannelName="Torque2",...
    PropertyNames=["wf_start_time" "wf_increment"])
props =

  1×2 table

    wf_increment            wf_start_time        
    ____________    _____________________________

       0.0001       2012-07-31 18:00:00.000000000

You can derive the sample rate by taking in the inverse of the wf_increment value.

rate = 1/props{1,"wf_increment"}
rate =

       10000

Input Arguments

collapse all

TDMS file name, specified as a string.

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.

For Internet files, specify the URL. For example, to read a remote file from the Amazon S3™ cloud:

data = tdmsread("s3://bucketname/path_to_file/data.tdms");

Example: "airlinesmall.tdms"

Data Types: char | string

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: ChannelGroupName="Torque",ChannelName="Torque2"

Supported name-value pairs are:

Channel group containing the channels to read from, specified as a string or character vector.

Example: ChannelGroupName="Torque"

Data Types: string | char

Name of channel to read, specified as a string or character vector. The channel must be in the channel group specified by ChannelGroupName.

Example: ChannelName="Torque2"

Data Types: char | string

Property names to read, specified as a string, string array, character vector, or cell array of character vectors. Supported properties depend upon file content and the specified channel group and channels.

Example: PropertyNames=["name" "description" "wf_start_time"]

Data Types: char | string | cell

Output Arguments

collapse all

Properties in the TDMS file, returned as a table.

Version History

Introduced in R2022a