How can i read multiples files from a directory?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have used a loop but i get only the content of the last file. Can someone help me? Thanks in advance
댓글 수: 0
답변 (1개)
Giorgos Papakonstantinou
2015년 3월 10일
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Export에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!