shuffle
Shuffle all data in datastore
Syntax
Description
Examples
Create an ImageDatastore object imds. Shuffle the files to create 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
Input datastore, specified as a datastore object. The input datastore can
be any datastore for which isShuffleable returns true (such as
imageDatastore). The input
datastore also can be a CombinedDatastore, SequentialDatastore, or TransformedDatastore for which all underlying datastores are
shuffleable.
Output Arguments
Output datastore, returned as a datastore object containing randomly
ordered data from ds.
Extended Capabilities
Usage notes and limitations:
In a thread-based environment, you can use
shuffleonly with the following datastores:ImageDatastoreobjectsCombinedDatastore,SequentialDatastore, orTransformedDatastoreobjects you create fromImageDatastoreobjects by usingcombineortransform
You can use
shufflewith other datastores if you have Parallel Computing Toolbox™. To do so, run the function using a process-backed parallel pool instead of usingbackgroundPoolorThreadPool(use eitherProcessPoolorClusterPool).
For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced in R2016a
See Also
ImageDatastore | datastore | isShuffleable | matlab.io.Datastore
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)