Load multiple matlab data files and convert them to text
Mostrar comentarios más antiguos
Hi!
I have multiple matlab data files with different names (with ECG data from multiple patients) and I want to load them all and convert them to text.
Also, the data is in structure form so I have to do the following for each file:
signal = load('FileName')
data = [signal.val];
writematrix(data,'FileName.txt','Delimiter',',');
How can I do it all at the same time? Thank you a lot in advance :)
Respuesta aceptada
Más respuestas (1)
Sulaymon Eshkabilov
el 4 de Jul. de 2021
If you are talking about series of files (e.g: P1.txt, P2.txt, ...) to load and convert their contents, then this might be an option:
for ii = 1:numel(Files)
FName = strcat('P', num2str(ii), '.txt');
signal = load(FName)
data = [signal.val];
writematrix(data,'FileName.txt','Delimiter',',', 'WriteMode','append');
end
1 comentario
Ana Gabriela Guedes
el 4 de Jul. de 2021
Categorías
Más información sobre Convert Image Type en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!