MATLAB: How to add images continuously to a imageDatastore

imagedatastore

Hi,
I'm new to the Matlab and using a imageDatastore object to store images comming from a camera, I want to update an existing image data store continuously. Is there a way to do that…?
Thanks..

Best Answer

Since the Files and Labels properties of the imageDatastore function return cell array of character vectors, you can directly use these to append/concatenate using the cat function.
For example:
imds = imageDatastore({'street1.jpg','street2.jpg','peppers.png','corn.tif'}); % Existing datastore
imds_new = imageDatastore({'cameraman.tif'}); %to append to the existing datastore
imds_cat = imageDatastore(cat(1, imds.Files, imds_new.Files));
imds_cat.Labels = cat(1, imds.Labels, imds_new.Labels)
imds = imds_cat;
Related Question