Borrar filtros
Borrar filtros

How can i read multiples files from a directory?

2 visualizaciones (últimos 30 días)
ellis
ellis el 10 de Mzo. de 2015
Respondida: Giorgos Papakonstantinou el 10 de Mzo. de 2015
I have used a loop but i get only the content of the last file. Can someone help me? Thanks in advance

Respuestas (1)

Giorgos Papakonstantinou
Giorgos Papakonstantinou el 10 de Mzo. de 2015
Assuming you want to open a few files. Create a cell|filenames|. Then the loop would be like this>
filenames = {'file1.txt' 'file10.txt' 'file11.txt'};
for ii=1:length(filenames)
fid = fopen(char(filenames(ii)));
.... % here you can do textscan for example
fclose(fid);
end

Categorías

Más información sobre Data Import and Export en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by