Create a list of images from subfolders with specific names using dir , strcat!
Show older comments
There should be two seperate for-loop but in the first loop it overwright and just I can get the last year images. I also tried fullfile but I got problem with the imread in the second loop because of the path name. I want to create a list of all images with special names as what assgined below among the total number located in diffrent subfolder. But It just gives the last years.
%activity= 'run' or 'dart'
year1 = 1980
year2= 2010
for num= year1:year2
switch activity
case 'Indai'
path = ['C\folder\competition\run','\',num2str(num),'\']; % get images with this name from all subfolders
if strcmp(age,'rd')
ag = 'old';
list_images= dir([datapath 'run_',num2str(d),'*_',country,ag,'.png'])
elseif strcmp(age,'rs') %German
ag = '';
list_images=dir([path 'run_',num2str(d),'*_',country,ag,'.png']);% get images with this name from all subfolders
end
ti = 1;
case 'Africa'
path = ['C\folder\competition\dart','\',num2str(num),'\'];
list_images=dir([datapath 'dart',country,'_',num2str(d),'*.png'])% get images with this name from all subfolders
ti = 2;
end
for i=1:length(images)
filename = strcat(images(i).folder,'/',images(i).name);% Concatenate strings horizontally to create a full path
I= imread(filename);% fo further process of showing image a series
end
Accepted Answer
More Answers (0)
Categories
Find more on Environment and Settings 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!