Getting inexistent files using dir function
古いコメントを表示
Hi All, need some help withh this. Im currently reading all files names froom my folder containing data using the script below. Althoughj my folder contains only 48 files, the finfo structure produced shows 52, including files with similar names to the ones that are real (e.g., V1_001) and 2 "ghosts" files. The prob is that I'm creating a loop with the length of the strcuture and reading the names nuumbers, which is affected bny this 4 odd/inexistent names/files. Any idea what is wrong here?
finfo = dir (strcat(pwd,'/',Schools{v}));
Many thansk
Eduardo

finfo = dir (strcat(pwd,'/',Schools{v}));
採用された回答
その他の回答 (1 件)
Image Analyst
2023 年 8 月 2 日
Try this:
folder = 'Volumes\EDUARDO-A\DET Data\HR_V1';
filePattern = fullfile(folder, 'V*.*'); % Only files that start with V
fileList = dir(filePattern);
for k = 1 : numel(fileList)
thisFile = fullfile(fileList(k).folder, fileList(k).name);
fprintf('Processing %s\n', thisFile);
% Now do something with the file.
end
カテゴリ
ヘルプ センター および File Exchange で Communications Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!