Want to iterate over subfolders within folder
Show older comments
I have a current working director or folder in MATLAB and wrote a function in this directory. Within this directory, I have a folder that contains 10 subfolders, each of which contains two different types of files (one is .edf and one is .xlsx). My function is designed to take an edf file and the corresponding xlsx file and compute something based on these.
So, my goal is to find a way that I can loop through these 10 subfolders and call my function on the edf and xlsx files in each subfolder one by one. Is there any way I can do this? Thanks.
4 Comments
Shri Chand
on 23 Mar 2023
Jon
on 23 Mar 2023
Please take a look at the documentation for the dir command. You will be able to do what you wanted using this comand. If it is not clear to you how to adapt this to your situation, please explain at what point you are stuck
Shri Chand
on 23 Mar 2023
Rik
on 23 Mar 2023
The point is that nothing in your question actually requires itterating through folders, only through file pairs. And dir can generate that list of files for you.
Accepted Answer
More Answers (0)
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!