Convert signals of a mf4 file to double variables
37 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hey guys,
for a project I need to import a MF4 File and for further analysis it needs to be converted to double. It would also be very helpful to predetermine certain variables that are mandatory so that the entire mass of signals doesnt to be processed.
time should also be available as a variable.
as far as of now i got this far:
messdaten=file;
m=mdf(messdaten);
lengthChannelNames = length(m.ChannelNames);
data = cell(1, lengthChannelNames);
for k = 1:lengthChannelNames
data{k} = read(m, k, m.ChannelNames{k});
end
0 comentarios
Respuestas (2)
Walter Roberson
el 31 de Ag. de 2022
https://www.mathworks.com/help/vnt/ug/read.html#bvcxtko-1
OutputFormat vector
Have you considered just making a single call rather than a loop? It would return a cell of timetable objects. You could cellfun(@(C)C{:,:}, data, 'UniformOutput', 0) to get a cell array of numeric data
9 comentarios
Walter Roberson
el 28 de Sept. de 2022
When in doubt about how to do something to multiple items.. write a loop. It might give you code that is not as compact as it could be, but it will not necessarily be any slower. For example each time that cellfun() is used, you have to call through an anonymous function, possibly one with captured variables; if you write the equivalent loop code with a plain call to the work function without going through an anonymous function, the result might be faster than cellfun.
Except in some unusual cases involving real-time systems, it is almost always better to get the functionality working and correct first, and only then stress out about making it more compact or faster. As long as you have a version that is working correctly, (A) you might find it is fast enough anyhow and not worth the effort of improving; and (B) you can use the correctly-working version to compare results against proposed optimizations to be sure that the results are the same. Getting all of the "edge conditions" right with straight-forward code is easier than trying to figure out all of the edge conditions with more compact or more vectorized versions of the code. Your primary duty in the great majority of cases is to get the correct answer first, not to get the fastest or smallest version first.
Ver también
Categorías
Más información sobre Logical 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!