MATLAB Answers

remove image from imageDatastore

36 views (last 30 days)
Stefan Frenzel
Stefan Frenzel on 18 Apr 2018
Answered: karim botros on 4 Mar 2019
I often encounter the need for excluding images from an imageDatastore object. One could remove the image from the corresponding file system directory and create the imageDatastore again, but that should not be the default way. How do I remove a single image once the imageDatastore has been defined?

Answers (1)

karim botros
karim botros on 4 Mar 2019
I have been looking for the same issue, and i found an easy work around to remove specific images from the imagedatastore
where {1,1} is the index of the data you want to delete
data.Files = setdiff(data.Files,data.Files{1,1})

Community Treasure Hunt

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

Start Hunting!