Read Files from Directory
Show older comments
Hey,
I'd like to be able to give a program a directory, and then have it run a second program on all files in that directory. For example, say I have a function, myFun(filePath) that reads, processes, and displays data from the file specified by filePath. Now, I'd like to write another function, in pseudocode below:
funtion dirFun(dirPath)
f = files(dirPath);
for x = 1:length(files);
myFun(f[x]);
end
Something like this. I want a function, here "files" which will return all of the file names within the directory, so that I can run the program on all my files. Is there such a function in MATLAB?
Accepted Answer
More Answers (1)
Andrii Mazur
on 16 Jun 2018
1 vote
Thank you!
Categories
Find more on File Operations 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!