shuffle - Shuffle all data in datastore - MATLAB (original) (raw)

Main Content

Shuffle all data in datastore

Syntax

Description

[dsrand](#bu4%5Fff9-1-imdsrand) = shuffle([ds](#bu4%5Fff9-1-imds)) returns a datastore object containing a random ordering of the data fromds.

example

Examples

collapse all

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 =

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

Output Arguments

collapse all

Output datastore, returned as a datastore object containing randomly ordered data from ds.

Extended Capabilities

expand all

Usage notes and limitations:

For more information, see Run MATLAB Functions in Thread-Based Environment.

Version History

Introduced in R2016a