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.

Compatibility Considerations

expand all

Not recommended starting in R2016b

Introduced in R2014b