Clear Filters
Clear Filters

automate calculate total of images saved in a folder

2 views (last 30 days)
i don't know how to type for the codings to automatic calculate the total of images saved as '.spm' in a folder and show the number of total on the designed interface using GUIDE.
  2 Comments
Melindalee
Melindalee on 10 Jul 2015
My question is about automatic calculate the total of images in a folder, i used the coding provided by Mr./Mrs/Miss Image Analyst and it works. Now i faced another problem is that i will have new folder for everyday, so how can i make it to automatic calculate the total of images in the folder everyday.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 10 Jul 2015
Try something like this:
filePattern = fullfile(yourFolder, '*.spm');
files = dir(filePattern);
numberOfFiles = length(files);
message = sprintf('Total number of spm files = %d', numberOfFiles);
set(handles.text1, 'String', message);
  8 Comments
Melindalee
Melindalee on 22 Jul 2015
Edited: Melindalee on 22 Jul 2015
yea i do my searching on datenum, currently i just able to get the date and time of computer and play with deduction or subtraction of day, i still havent figure out how to get the modified date of files..
datenow = datestr(clock,0);
dateNowNum = datenum(datenow);
date12hrsBe4r = datestr(dateNowNum-0.50);
this just for finding current time and the time of 12 hours ago..i wanted to make it as a range and calculate how many files which their date and time are within this range, but i still have no idea on how to write the codings, do you still have any suggestion?
Melindalee
Melindalee on 5 Aug 2015
Edited: Melindalee on 5 Aug 2015
I'd found the solution, anyway thank you very much =D

Sign in to comment.

More Answers (0)

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!