find total number of images in a folder

159 views (last 30 days)
how to find total number of images in a folder through coding....

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 2 Mar 2013
Edited: Azzi Abdelmalek on 2 Mar 2013
a=dir([yourfolder '/*.jpg'])
out=size(a,1)

More Answers (1)

Mritula C
Mritula C on 17 Dec 2018
Thanks,
a=dir([yourfolder '/*.jpg'])
This worked fine!!
  2 Comments
Saurabh Sharma
Saurabh Sharma on 11 Aug 2019
What did you write in place of "yourfolder" ?
Walter Roberson
Walter Roberson on 12 Aug 2019
The folder name that you wanted to find the images of.
We recommend using fullfile() instead of the code there:
yourfolder = 'C:\Students\CS907\Assignment3\BananaPictures';
a = dir(fullfile(yourfolder, '*.jpg'));

Sign in to comment.

Categories

Find more on Modify Image Colors 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!