keep few images and delete the rest in a folder

1 次查看(过去 30 天)
Suppose I have 10 images, and i have saved all the pathname and filename in a variable all_files
I have a vector b = [ 2 4 6 ];
Now I want to keep only these images and delete all the other 7 images
How to keep those images and delete the rest?

采纳的回答

Walter Roberson
Walter Roberson 2022-8-4
dels = setdiff(1:length(all_files), b);
arrayfun(@(idx)delete(all_files{idx}), dels);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by