Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

1 Ansicht (letzte 30 Tage)
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

Antworten (1)

Akira Agata
Akira Agata am 10 Okt. 2018
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?

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by