How can I recursively process files in subdirectories using MATLAB?
Afficher commentaires plus anciens
How can I recursively process files in subdirectories using MATLAB?
I have files located in multiple subdirectories within a directory. I would like to be able to process the data in each subdirectory using the same functions. How can I do this without having to manually run the code in each directory?
Réponse acceptée
Plus de réponses (1)
lvn
le 11 Mar 2020
It is high time Matlab updates some of the official answers, as many are outdated.
This is an example, as of R2016b, no need for external tools:
files=dir('C:\temp\**\*.txt');
for k=1:length(files)
fn=fullfile(files(k).folder, files(k).name);
%process the file fn here
end
Catégories
En savoir plus sur File Operations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!