how to import text files in different subfolders with the same names?

There are main folder A First subfolders A1 to An Second subfolders A11 to A1m; A21 to A2m; .... ; An1 to Anm Third subfolders A111 to A11K; A1m1 to A1mk; ... ; Anm1 to Anmk The image of the structure is attached. There are many text files with the same names in the third subfolders, I need to import and compare the text files with the same names in each third subfolders (i.e., gm.txt in A111 to Anmk). Please note there are some other text files than gm.txt in the third subfolders as well. the text files were created by another application with the same names (gm.txt)

3 Comments

Loop over the folders and import the files. What is the problem? What have you tried so far?
If you search this forum you will find many examples of how to loop over subdirectories.
Stephan, BASED ON THE ATTACHED FIGURE, do I have to loop over n, m, and k ?
You could also generate indices with meshgrid, but a nested loop is by far the easiest.

Sign in to comment.

Answers (0)

Categories

Asked:

on 23 Dec 2017

Commented:

Rik
on 23 Dec 2017

Community Treasure Hunt

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

Start Hunting!