Load files in a loop
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Image Analyst
le 6 Avr 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 commentaires
Voir également
Catégories
En savoir plus sur File Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!