Reading and Writing TDMS-Files in MATLAB
TDMS is a binary file format structured in three levels of hierarchy called file, channel group, and channel. The data is recorded in each channel and metadata can be added to each level of the hierarchy. Learn how to inspect and read TDMS-files in MATLAB® using Data Acquisition Toolbox™, how a datastore can be used to analyze a collection of TDMS-files, and finally, how to write data to a TDMS-file and update its metadata.
The example showcases the vibrational analysis of a rotating shaft. On the rotating shaft, there are two displacement sensors—X and Y—that measure changes in distance between the machine’s rotating element and its stationary frame. There is a key phasor signal that provides a reference point in the machine’s rotation to correlate other vibration signals and measure shaft rotational speed.
The 'tdmsinfo' function provides an overview of the file, while the 'ChannelList' field shows the channel groups and channels in the file. The 'tdmsreadprop' function provides the channel properties such as 'wf_increment', which displays the timestamp in seconds. The data is first read using the 'tdmsread' function and then plotted. Next, a frequency domain analysis is performed on the signals to determine where the machine is out of balance; this is based on the phase shift between the vibration sinusoidal peak and the phase reference pulse.
Datastores in MATLAB allow the user to iterate over a single large file or a collection of files that have the same layout. The 'tdmsDatastore' function is used to iterate over a collection of vibration measurement. The 'transform' function is then run to take in a datastore and function handle, returning a transformed datastore object. Here, a custom function is applied to each of the recorded TDMS-files.
The results of the analysis are written to a new TDMS-file, and data is read back to validate the results. The 'tdmsreadprop' function is used to update TDMS channel properties, such as ChannelGroupName, ChannelName, and unit_string.
Published: 30 Jun 2023
Featured Product
Data Acquisition Toolbox
Up Next:
Related Videos:
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)
Asien-Pazifik
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)