Main Content

shuffle

对数据存储中的所有数据进行乱序处理

说明

示例

dsrand = shuffle(ds) 返回一个数据存储对象,其中包含来自 ds 的随机排序数据。

示例

全部折叠

创建 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

输入参数

全部折叠

输入数据存储,指定为数据存储对象。输入数据存储可以是 isShuffleable 对其返回 true 的任何数据存储(如 imageDatastore)。输入数据存储也可以是其所有基础数据存储均可乱序的 CombinedDatastoreSequentialDatastoreTransformedDatastore

输出参数

全部折叠

输出数据存储,以数据存储对象形式返回,其中包含来自 ds 的随机排序数据。

扩展功能

版本历史记录

在 R2016a 中推出