フィルターのクリア

Info

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

How to access last 5 images from the list of sub folders and save it in some order of folders?

1 回表示 (過去 30 日間)
Muhammad Kashif
Muhammad Kashif 2018 年 10 月 8 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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

回答 (1 件)

Akira Agata
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?

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by