keep few images and delete the rest in a folder

조회 수: 2 (최근 30일)
Elysi Cochin
Elysi Cochin 2022년 8월 4일
편집: Elysi Cochin 2022년 8월 4일
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