Reading many files in one loop
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Jan
2013-4-4
It is not useful to convert filenames to a matrix. Do you want to import the file's contents into a matrix?
采纳的回答
Ahmed A. Selman
2013-4-18
Download a function file called folderFiles.m.
It'll do the job for you, hopefully.
0 个评论
更多回答(2 个)
ChristianW
2013-4-4
doc dir
D = dir([myfolder 'my*file*name*.*']);
files = {D.name}';
2 个评论
Jan
2013-4-18
编辑:Jan
2013-4-18
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
2013-4-4
It is always a good idea to read the FAQ, because it is efficient to profit from the errors of others.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!