Loops in sub folders
Mostrar comentarios más antiguos
I have 10 folders and each one has subfolder which has the same name of all 10 called test. under test folders have subfolders named test1 including the data want to plot two rows.
14 comentarios
Jan
el 15 de En. de 2018
Okay. What is your question? I'm not really able to follow your explanations. Do you have 100 subfolders, which contain folders, which contain the actually wanted files?
Star Strider
el 15 de En. de 2018
The Question:
Hello star, how can I do his command in loop under different folders in different directories.
if true
data = load(strcat('C.....', filePaths(i,:) ,LPCC.dat')); end
Star Strider
el 15 de En. de 2018
My response:
Najiya Omar
el 15 de En. de 2018
10 folders each one has folder named test. Every test folder has folder named test1 including the data.
Jan
el 15 de En. de 2018
@Najiya Omar: What exactly is your question?
Jan
el 15 de En. de 2018
Since Matlab R2016b the dir command accepts the '/**/' key to search recursively in subfolders.
Najiya Omar
el 15 de En. de 2018
Editada: Najiya Omar
el 15 de En. de 2018
Image Analyst
el 15 de En. de 2018
And my demo below didn't work??? Please show how you adapted it.
Najiya Omar
el 16 de En. de 2018
Image Analyst
el 16 de En. de 2018
Why not??? Just make the obvious changes. Just change the starting path to be whatever top level folder you want, and change the file pattern from . or *.m to *.dat or whatever you want and it should work fine.
Najiya Omar
el 16 de En. de 2018
Image Analyst
el 16 de En. de 2018
I can't debug your adaptation of my code. I have neither the Crystal Ball Toolbox, nor the Mind Reading Toolbox. The only known beta version is only in the hands of Walter Roberson. Until I get a copy, or he answers you, you'll have to post your m-file for us mere mortals.
Najiya Omar
el 16 de En. de 2018
Thanks
Jan
el 16 de En. de 2018
This will not work because it pads the char matrix with spaces:
myPaths = ['100H' ; '200H' ; '300H' ; '400H' ; '%700H' ; '800H' ; '900H' ; '10000H'];
Use a cell string instead:
myPaths = {'100H' ; '200H' ; '300H' ; '400H' ; '%700H' ; '800H' ; '900H' ; '10000H'};
and replace myPaths(i,:) by myPaths{i}.
Respuestas (2)
Image Analyst
el 15 de En. de 2018
0 votos
See attached demos to recursively find files in folders and subfolders.
Najiya Omar
el 16 de En. de 2018
0 votos
Categorías
Más información sobre File Operations 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!