Load files in a loop
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I didn't see an answer to this question anyway, and it's very possible I missed it. But I was wondering if anyone could help me load files in several folders in a loop.
The situation I have is folder A with folders AA,BB,CC within. AA contains A1,A2,A3, BB contains B1,B2,B3 and CC contains C1,C2,C3. But withint AA,BB,CC I only want the 15 files contained in the second folder.
I tried this:
cd('C:\A');
fault = dir(cd)
for i=3:length(fault); data=dir(fault(i));
for ii=3:length(data);
data2=dir(data(ii));
end
end
But that clearly didn't work.
Any suggestions?
0 Kommentare
Antworten (1)
Image Analyst
am 6 Apr. 2015
Check out the attached demo where I get all subfolders of a folder and go into all the folders getting the names of all the files in each folder. I use genpath() and dir(). Feel free to adapt the file patterns you pass to dir() as needed for your situation.
0 Kommentare
Siehe auch
Kategorien
Mehr zu File Operations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!