I would like to recursively proces files in subdirectories using MATLAB. I have three subject-specific subdirectories (sub_001, sub_002, sub_003) in a main directory, A, each of which contains a .nii file, B.
In linux, this is possible using a for loop with a .txt file containg a listing of the main directory. For example:
for i in `cat list.txt`; do mv /A/$i/B /path/to/new/destination; done
Can the same be acheived in MATLAB? Essentially, the only thing that needs to change in each iteration is the subject's directory.