Main Content

shuffle

Shuffle all data in datastore

Description

example

dsrand= shuffle(ds)returns a datastore object containing a random ordering of the data fromds

Examples

collapse all

Create anImageDatastoreobjectimds。洗牌创建的文件a new datastore containing the same files in random order.

imds = imageDatastore(fullfile(matlabroot,'toolbox','matlab', {'demos','imagesci'}),'LabelSource','foldernames','FileExtensions', {'.jpg','.png','.tif'})
imds = ImageDatastore with properties: Files: { ' ...\matlab\toolbox\matlab\demos\cloudCombined.jpg'; ' ...\matlab\toolbox\matlab\demos\example.tif'; ' ...\matlab\toolbox\matlab\demos\landOcean.jpg' ... and 5 more } Labels: [demos; demos; demos ... and 5 more categorical] ReadFcn: @readDatastoreImage
imdsrand = shuffle(imds)
imdsrand = ImageDatastore with properties: Files: { ' ...\matlab\toolbox\matlab\demos\street2.jpg'; ' ...\matlab\toolbox\matlab\demos\landOcean.jpg'; ' ...\matlab\toolbox\matlab\imagesci\corn.tif' ... and 5 more } Labels: [demos; demos; imagesci ... and 5 more categorical] ReadFcn: @readDatastoreImage

Input Arguments

collapse all

Input datastore, specified as a datastore object. The input datastore can be any datastore for whichisShuffleablereturnstrue(such asimageDatastore). The input datastore also can be aCombinedDatastoreorTransformedDatastorefor which all underlying datastores are shuffleable.

Output Arguments

collapse all

Output datastore, returned as a datastore object containing randomly ordered data fromds

Extended Capabilities

Version History

Introduced in R2016a