Accessing Subfloders of Subfolders in MATLAB

3 views (last 30 days)
Hey,
I have a main folder which consists of 40 subfolders. Each of these subfolders have 3 other subfolders and these subfolders contain '.xml' files. Could any of you help me with access of these '.xml' files using a matlab code?

Accepted Answer

Jan
Jan on 3 Sep 2021
BaseFolder = 'D:\Your\BaseFolder';
FileList = dir(fullfile(BaseFolder, '**', '*.xml'));
for k = 1:numel(FileList)
File = fullfile(FileList(k).folder, FileList(k).name);
disp(File);
... % Insert what you want to do with the file here
end

More Answers (0)

Categories

Find more on Argument Definitions in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!