I need to create a nested struct from nested folders
Show older comments
I have some folders in the following way:
Folder 1
Folder 1.1
Folder 1.1.1
img 1.1.1.1
.
.
.
img 1.1.1.36 (between 35 to 37 imgs in each folder)
Folder 1.1.2
img 1.1.2.a
.
.
.
img 1.1.2.37 (between 35 to 37 imgs in each folder)
.
.
.
.
Folder 1.1.148098
I have to combine the img files to form videos. I am trying to create nested structures so that I can access the images (img 1.1.1.1. etc. in each folder). I have tried 'dir' but it does not create nested structures. These videos will be inputs for my ML model and I don't want to use multiple for loops if I can avoid it.
Specifically (apologies if I am providing redundant explanation), I want to do something like:
for i = 1: size(Folder1.Folder1.1.Folder1.1.1.Folder 1.1.1)
image= imread(Folder1.Folder1.1.Folder1.1.1.Folder 1.1.1.img1.1.1.i)
writevideo(v, image)
end
Any help is appreciated.
Accepted Answer
More Answers (0)
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!