Want to iterate over subfolders within folder
显示 更早的评论
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 个评论
Shri Chand
2023-3-23
Jon
2023-3-23
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
2023-3-23
Rik
2023-3-23
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.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Software Development Tools 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!