Running a code on multiple files in a folder and saving each output

18 views (last 30 days)
I need help on a trivial issue. I am new to matlab and I just learnt the basics of matlab computing with which I have designed an algorithm for my purpose. Now, I need to run this code for many hundreds of files. There are many folders within which there are many files. Each folder has about 150 odd files. I need to run the same code on each of the 150 files and save the 150 output files in a new folder. So, if I give the path of the folder, the code should run my algorithm on each file in the folder and after running in a file, the output of the file should be stored as a new file in a new folder. If I have 1 folder with 100 input files, I should get an output of another folder with 100 output files. Help on this would be really appreciated.
  2 Comments
Titus Edelhofer
Titus Edelhofer on 23 Nov 2012
Hi Aravind,
if you enter "multiple files" into the search field you will get multiple questions (with their respective answers) ...
Titus
Aravind
Aravind on 23 Nov 2012
Edited: Aravind on 23 Nov 2012
Hi Titus
I have done that search. However, I am not able to find a satisfying answer. I tried sprintf but with vain. Can you give me link of an example?

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 23 Nov 2012
Please refer to the FAQ for several code examples: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F

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!