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
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)