Error using ConvertTDMS (v10)

3 visualizaciones (últimos 30 días)
Waseem Shaik
Waseem Shaik el 22 de Nov. de 2022
Respondida: Rishav el 11 de Sept. de 2023
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);

Respuestas (1)

Rishav
Rishav el 11 de Sept. de 2023
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

Categorías

Más información sobre TDMS Format Files en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by