Error using ConvertTDMS (v10)

9 ビュー (過去 30 日間)
Waseem Shaik
Waseem Shaik 2022 年 11 月 22 日
回答済み: Rishav 2023 年 9 月 11 日
ConvertTDMS code for processing tdms files has issues. This code is not working if TDMS file has 2 groups with different frequencies. But It is working good if both groups has 50Hz frequency
For me I have 2 groups; Group 1 is 50 HZ and Group 2 is 1000 Hz then but the same code is working good if both the groups are 50Hz.
Unable to perform assignment because the left and right sides have a different number of elements.
Error in convertTDMS>postProcess (line 1360)
Value(c)=index.(cname).(cfield).value;
Error in convertTDMS (line 322)
[ConvertedData(fnum).data,CurrGroupNames]=postProcess(ob,channelinfo);

回答 (1 件)

Rishav
Rishav 2023 年 9 月 11 日
Hi Waseem,
I understand that you are facing an issue when the TDMS file has two groups with different frequencies.
The workaround here is to process both the groups separately:
  • Create separate variables or data structures to store data from each group.
  • Process each group independently based on its frequency.
Here's an example:
% Load the TDMS file using the appropriate library or function.
% Replace 'your_tdms_file.tdms' with the actual file path.
tdmsFile = tdmsread('your_tdms_file.tdms');
% Identify the groups and their properties
groupNames = fieldnames(tdmsFile.groups);
numGroups = numel(groupNames);
% Process each group separately
for i = 1:numGroups
groupName = groupNames{i};
groupData = tdmsFile.groups.(groupName);
% Check the frequency of the group and process accordingly
if groupData.Frequency == 50
% Process data for a 50Hz group
% You may have specific code here for 50Hz data
elseif groupData.Frequency == 1000
% Process data for a 1000Hz group
% You may have specific code here for 1000Hz data
end
end
Here in this code, we iterate through each group in TDMS file, check its frequency and process the data accordingly.
Thank you,
Rishav Saha

カテゴリ

Help Center および File ExchangeTest and Measurement についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by