read .png from different subfolder

I have a folder with a lot of subfolders. I want to read all .png in one subfolder and save and then go to the second subfolder and read all the .png and save and then go to the third subfolder etc. anyone can help me with it?

답변 (2개)

Image Analyst
Image Analyst 2014년 2월 26일

1 개 추천

See my attached demo to recurse into subfolders.
Azzi Abdelmalek
Azzi Abdelmalek 2014년 2월 26일
편집: Azzi Abdelmalek 2014년 2월 26일

0 개 추천

folder='E:\matlab'
d=dir(folder)
subf=d([d.isdir])
im=[]
for k=3:numel(subf)
subfolder=subf(k).name
subf1=fullfile(folder,subfolder)
f=dir([subf1 '\*.png'])
for ii=1:numel(f)
file=fullfile(subf1,f(ii).name);
im{end+1}=imread(file);
end
end
im

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

질문:

2014년 2월 26일

편집:

2014년 2월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by