Main Content


(Not recommended) Read image at specified index

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



im = read(imgSet,idx) returns an image from the image set, imgSet, located at the index idx.


collapse all

Create an image set.

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

Display the fourth image from the set.

imshow(read(imgSet, 4));

Figure contains an axes. The axes contains an object of type image.

Input Arguments

collapse all

Image set, specified as an imageSet object.

Image location index, specified as a positive integer.

Output Arguments

collapse all

Image, returned as a numeric array.

Compatibility Considerations

expand all

Not recommended starting in R2016b

Introduced in R2014b