I would like to perform the same operation on many images in the same folder stored in C drive of my computer. How to do the same with respect to the code attached ??

This is my code for detecting black spot. Well, I would like to perform the same operation on many images in the same folder stored in C drive of my computer. How to do the same with respect to the code attached ??

 Accepted Answer

s = dir( folder );
folderFiles = s( ~[s.isdir] );
filenames = { filderFiles.name };
will give you a list of filenames in the directory. You can interrogate these using fileparts and/or string-based functions such as strcmp to get rid of those that don't have the correct extension or are hidden files or some other type of file you do not want.
Then just loop over the rest with your code.

2 Comments

thnaks a lot sir ! but it would be helpful if you could please get me the exact code for the given file since it has basefilename references to me made use of.
You haven't explained anything about a base filename and how it should be used with respect to other files in the same directory. I can see it in your code, but that doesn't imply anything about using this base filename for anything else.

Sign in to comment.

Categories

Asked:

on 12 Jan 2015

Edited:

on 12 Jan 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!