Info
此问题已关闭。 请重新打开它进行编辑或回答。
How to access last 5 images from the list of sub folders and save it in some order of folders?
1 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197308/image.png)
I have a dataset containing multiple subfolders. i will give some description.
Main Folder(Casia)
2-Sub folders (1-NI_Acropped, 2-VL_Acropped)
each have 3 sub folders(1.1- Dark, 1.2-Strong, 1.3-Weak)
each have 80 sub folders(P001, P002, ... P080)
each have 6 sub folders (ANG, DIS, FEA, HAP, SAD SUR).
Q1 I want to make a logic that creates the folders like this:
Main Folder(Casia)
2-Sub folders (1-NI_Acropped, 2-VL_Acropped)
each have 3 sub folders(1.1- Dark, 1.2-Strong, 1.3-Weak)
and discard 80 folder and make 6-sub folder in dark strong and in weak
like for everyone.
Q2 Now Can access last 5 images of every 6 folders of every 80 folders and save it to the created folders in Q1.
See the attach pic for detail. Please Help me to create the logic
0 个评论
回答(1 个)
Akira Agata
2018-10-10
Regarding your Q1, the following script can copy the 'NI_Acropped' folder structure to 'VL_Acropped' without copying files.
list = dir('./NI_Acropped/**/*');
list = struct2table(list);
idx = ismember(list.name,{'.','..'});
list(idx,:) = [];
for kk = 1:height(list)
if list.isdir(kk)
dirPath = fullfile(...
strrep(list.folder{kk},'NI_Acropped','VL_Acropped'),list.name{kk});
mkdir(dirPath);
end
end
As for your Q2, what do you mean by "last 5 images" ? Is it the last 5 files in file list, sorted by file name, for each subfolder?
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!