How would you read a specific channel in a tdms file in matlab?

2 Ansichten (letzte 30 Tage)
Nandith Chandy
Nandith Chandy am 27 Mär. 2022
Kommentiert: Voss am 27 Mär. 2022
How would you call a specific channel in a struct that has been generated from a TDMS file.
In the attached picture I use convertTDMS to create a struct file. How do I go about this:-
Finding the index to match a name so that I can plot the data associated with that name?
for example how would you find the index of the string 'Synchronous/Air Manifold Pressure' in the Name and plot the coinciding data fo that Name?

Akzeptierte Antwort

Voss
Voss am 27 Mär. 2022
If you might have any number of elements of the struct array data.Data.MeasuredData whose 'Name' field is 'Synchronous/Air Manifold Pressure', one way to plot their Data is:
idx = find(strcmp({data.Data.MeasuredData.Name},'Synchronous/Air Manifold Pressure'));
for ii = idx(:).'
plot(data.Data.MeasuredData(ii).Data);
hold on
end
If instead you know there will always be exactly one element of the struct array data.Data.MeasuredData whose 'Name' field is 'Synchronous/Air Manifold Pressure', you can make it simpler:
plot(data.Data.MeasuredData(strcmp({data.Data.MeasuredData.Name},'Synchronous/Air Manifold Pressure')).Data);

Weitere Antworten (0)

Kategorien

Mehr zu Instrument Connection and Communication finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by