Getting inexistent files using dir function
Ältere Kommentare anzeigen
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}));
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 2 Aug. 2023
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
Kategorien
Mehr zu Communications Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!