Reading many files in one loop
Mostrar comentarios más antiguos
How can I read file names and convert them to a matrix? I have more than one file and I want to read their contents in one loop of the program. Thanks
3 comentarios
Tobias
el 4 de Abr. de 2013
What is your current code? I assume you must have tried something yourself. Which errors are you getting?
Jan
el 4 de Abr. de 2013
It is not useful to convert filenames to a matrix. Do you want to import the file's contents into a matrix?
John
el 12 de Abr. de 2013
Respuesta aceptada
Más respuestas (2)
ChristianW
el 4 de Abr. de 2013
doc dir
D = dir([myfolder 'my*file*name*.*']);
files = {D.name}';
2 comentarios
John
el 12 de Abr. de 2013
This means, that no file matchs the filter:
'C:\Documents and Settings\John\My Documents\MATLAB\Pic_Down*.jpg'
Perhaps you want:
'C:\Documents and Settings\John\My Documents\MATLAB\Pic_Down\*.jpg'
Note: fullfile() is much better for constructing file names than STRCAT, HORZCAT or [.].
Jan
el 4 de Abr. de 2013
0 votos
It is always a good idea to read the FAQ, because it is efficient to profit from the errors of others.
Categorías
Más información sobre String Parsing 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!