Loop through multiple csv files
조회 수: 6 (최근 30일)
이전 댓글 표시
I have 2550 csv files. I have created a code that calculates a value for one of the files, but i need to loop over all 2550 and add together that value calculated for each csv file.
댓글 수: 2
per isakson
2016년 8월 25일
"I have 2550 csv files"   How to make a list of these files? Are they in a special folder? Are there some special characteristics in their names?
답변 (1개)
per isakson
2016년 8월 25일
This is one approach, (which I like)
folderspec = 'c:\same\folder';
file_glob = 'Scan_*.csv';
sad = dir( fullfile( folderspec, file_glob ) );
for jj = 1 : length( sad )
fid = fopen( fullfile( folderspec, sad(jj).name ), 'r' );
cac = textscan( fid, ... );
fclose( fid );
...
...
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Text Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!