Slow tdmsread Performance with Large Dataset - Seeking Solutions to Reduce Sampling Rate
12 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone,
I'm encountering significant performance issues when using tdmsread to process a large TDMS file (1.2Gb) with the following specifications:
- NumSamples: 80,000
- ChannelName count: 7,000
Currently, reading all channels takes an unacceptably long time. Since I need to analyze all 7,000 channels, I'm exploring ways to reduce the sampling rate (e.g., from 80,000 to 10,000 samples) to speed up the process.My Questions:
- Is there a built-in way to specify a lower sampling rate when using tdmsread or tdmsDatastore? For example, can I directly read every 8th sample to achieve a 10x reduction?
- If not, what's the most efficient approach to downsample the data during reading rather than after loading the entire dataset into memory?
- Are there alternative functions or workflows (e.g., using datastore properties) that can handle this scenario more efficiently?
0 件のコメント
回答 (1 件)
Shishir Reddy
2025 年 6 月 18 日
Hi @Kunpeng
Reading a large TDMS file with thousands of channels and high sample counts can lead to significant performance bottlenecks.
Currently, 'tdmsread' and 'tdmsDatastore' do not support direct downsampling (such as reading every Nth sample) during file access. They are designed to load the raw data directly from the file.
To avoid loading the entire dataset into memory, consider combining 'tdmsDatastore' with a 'custom read function' that reads data in chunks and performs downsampling on-the-fly which is demonstrated in the following code snippet.
ds = tdmsDatastore("yourfile.tdms");
ds.ReadSize = 1000; % Tune based on available memory
while hasdata(ds)
dataChunk = read(ds);
dataChunk = dataChunk(1:8:end, :);
% Further processing or saving
end
As there is no out of the box parameter to downsample directly in 'tdmsread', but using 'tdmsDatastore' with on-the-fly processing is the best option for memory efficient downsampling.
For more information regarding 'tdmsread' and 'tdmsDatastore' functions, kindly refer the following documentations
I hope this helps
参考
カテゴリ
Help Center および File Exchange で TDMS Format Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!