Main Content


(Not recommended) Select subset of images from image set

The select function of the imageSet object is not recommended. Instead, use an imageDatastore object and its subset function. For more information, see Compatibility Considerations.



imgSetOut = select(imgSet,idx) returns a subset of image set, imgSet, using the selection of images specified by the index idx.


collapse all

Read images from a folder.

imgFolder = fullfile(matlabroot,'toolbox','vision','visiondata','stopSignImages');
imgSet  = imageSet(imgFolder);

Select images 2 and 4 from the image set.

imgSetOut = select(imgSet, [2, 4]);

Select every other image from the image set.

imgSetOut2 = select(imgSet, 1:2:imgSet.Count);

Input Arguments

collapse all

Image set, specified as an imageSet object.

Image location index, specified as a scalar, vector of linear indices, or a vector of logical indices. The function uses the idx index to select the subset of images.

Output Arguments

collapse all

Subset of the input image set, returned as an imageSet object.

Version History

Introduced in R2014b

collapse all

R2016b: select is not recommended

The imageSet object and its select function are not recommended. Instead, manage collections of image data using an imageDatastore object, and select subsets of images from the image datastore using the subset function. There are no plans to remove the select function of the imageSet object.