I have the code like this:
myFolder='C:\Users\abe7rt\Desktop\dat\1';
filePattern=fullfile(myFolder, '*.txt');
txtFiles=dir(filePattern);
Now, dat is a folder that contains "1,2,3" folders and each one of these folders contains 20 TXT files. The previous code is able to get the txt files from 1 folder. Now my question is: is there a way to loop over all the directories?