Info

この質問は閉じられています。 編集または回答するには再度開いてください。

how to process a folder of files and save them in different folder with the same file name

1 回表示 (過去 30 日間)
Jyothi Alugolu
Jyothi Alugolu 2017 年 2 月 27 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
i have a database of iris images in 224 folders, each corresponding to 224 subjects. Now the database has a label 'L' or 'R' which designates left or right eye. There are 1288 images from 224 subject that are from left eyes while the rest images from 211 subjects are from right eyes.Except folders 1-13, 27, 55 and 65 all other folders have five left and 5 right eye images. Now,i want to read each image from the folder and do some calculations and save the output in another folder.can anyone help me with this??? i am sending 5 folder of images..
  1 件のコメント
Jan
Jan 2017 年 2 月 27 日
編集済み: Jan 2017 年 2 月 27 日
You are sending 5 folders of images? Do the number of images or if they are right or left matter for this question? Does "database" mean, that you you a database program or is this only the collection of files on the disk?

回答 (1 件)

Jan
Jan 2017 年 2 月 27 日
BaseFolder = 'C:\Temp'; % Adjust accordingly
FolderList = dir(fullfile(BaseFolder, '*.*'));
FolderList = FolderList([FolderList.isdir]); % folders only
for iFolder = 1:numel(FolderList)
Folder = fullfile(BaseFolder, FolderList(iFolder).name);
FileList = dir(fullfile(Folder, '*.jpg')); % Or however your files are found
for iFile = 1:numel(FileList)
File = fullfile(Folder, FileList(iFile).name);
... Do what you want with this file
... Save it to different folder
end
end

Community Treasure Hunt

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

Start Hunting!

Translated by