Getting inexistent files using dir function
Mostrar comentarios más antiguos
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}));
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 2 de Ag. de 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
Categorías
Más información sobre Communications Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!