Main Content

shuffle

データストア内のすべてのデータをシャッフルする

説明

dsrand = shuffle(ds) は、ds のデータをランダムな順序で含む datastore オブジェクトを返します。

すべて折りたたむ

ImageDatastore オブジェクト imds を作成します。ファイルをシャッフルして、同じファイルをランダムな順序で含む新しいデータストアを作成します。

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

入力引数

すべて折りたたむ

入力データストア。datastore オブジェクトとして指定します。入力データストアには、isShuffleabletrue を返す任意のデータストア (imageDatastore など) を指定できます。また、入力データストアには、基となるすべてのデータストアがシャッフル可能な CombinedDatastoreSequentialDatastore、または TransformedDatastore も指定できます。

出力引数

すべて折りたたむ

出力データストア。ds のデータをランダムな順序で含む datastore オブジェクトとして返されます。

拡張機能

バージョン履歴

R2016a で導入