How would you read a specific channel in a tdms file in matlab?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nandith Chandy
el 27 de Mzo. de 2022
Comentada: Voss
el 27 de Mzo. de 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?
0 comentarios
Respuesta aceptada
Voss
el 27 de Mzo. de 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);
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Instrument Connection and Communication en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!