tdmsread
Description
retrieves data from the specified TDMS file and returns a cell array of tables. Each element
of the cell array is a table corresponding to a channel group.data
= tdmsread(tdmsfile
)
uses name-value pairs to filter the data reading and specify output format.data
= tdmsread(tdmsfile
,Name=Value
)
Examples
Read TDMS File Data
Read data from a specified TDMS file. You can determine which channels are read, and what format the result has.
Read all data from a TDMS file into a table.
data = tdmsread("airlinesmall.tdms");
Read a subset of the variables in a TDMS file into MATLAB® as a timetable. Use the variable ArrTime
in the TDMS
file as the time vector of the output timetable.
data = tdmsread("airlinesmall.tdms", ... ChannelGroupName = "Airline", ... ChannelNames = ["ArrTime" "FlightNum" "ArrDelay"], ... RowTimes = "ArrTime");
Read the channel data into a timetable with a specified start time and step duration.
data = tdmsread("airlinesmall.tdms", ... ChannelGroupName = "Airline", ... ChannelNames = ["ArrTime" "FlightNum" "ArrDelay"], ... TimeStep = seconds(0.01), StartTime = seconds(30));
Input Arguments
tdmsfile
— TDMS file name
string
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",ChannelNames="Torque1"
Supported name-value pairs are:
ChannelGroupName
— Channel group containing the channels to read from
string | char
Channel group containing the channels to read from, specified as a string or character vector.
Example: "Torque"
Data Types: string
| char
ChannelNames
— Names of channels to read
char | string | cell
Names of channels to read, specified as a string, string array, character vector,
or cell array of character vectors. The channels must be in the channel group
specified by ChannelGroupName
.
Example: ["Torque1" "Torque2"]
Data Types: char
| string
| cell
RowTimes
— Times associated with rows of table
datetime | duration | channel name
Times associated with rows of the table, specified as a selected time channel name, a datetime vector, or a duration vector. Specifying this option causes the function to output a cell array of timetables. Each time element labels a row in the output timetable.
Example: duration(seconds([1:1000]/1000))
Data Types: datetime
| duration
| string
StartTime
— Start time of output timetable
datetime | duration
Start time of the output timetable, specified as a scalar datetime or duration indicating the time of the first data record in the timetable.
Example: StartTime=seconds(60)
Data Types: datetime
| duration
SampleRate
— Sample rate of output timetable
double
Sample rate of the output timetable, specified as a positive scalar double indicating samples per second.
Example: SampleRate=1000
Data Types: double
TimeStep
— Step time of output timetable
duration | calendarDuration
Time step of the output timetable, specified as a scalar duration or calendarDuration indicating the time span between data records.
Example: TimeStep=seconds(0.01)
Data Types: duration
| calendarDuration
Output Arguments
data
— Output data
cell array of tables
Output data, returned as a cell array of tables or timetables with data records from the TDMS file. Each element of the cell array is a table or timetable for a channel group. The cell array index corresponds to the channel group number.
When the start time for the first sample is 0 and the sample times are relative to that (duration), the sample times returned to the timetable are based on seconds since the epoch in the local time zone equivalent to 01/01/1904 00:00:00.00 UTC (using the Gregorian calendar and ignoring leap seconds). For more information, see TDMS File Format Internal Structure.
Limitations
TDMS functions are supported on Windows® platforms only.
Version History
Introduced in R2022a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)