How to load a txt file and save the workspace
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have txt files numbered like data_1, data_2, data_3 data_4..
And I want to load these files into workspace named 1, 2,3,4. How should I write the code?
2 comentarios
Respuestas (1)
Mathieu NOE
el 22 de Sept. de 2023
you can create a structure D where all informations are stored (filenames and data)
D = dir('*.txt'); % D is a structure array
for k = 1:numel(D)
D(k).data = readmatrix(D(k).name);
end
0 comentarios
Ver también
Categorías
Más información sobre Structures 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!