partition
Class: matlab.io.datastore.DsFileSet
Namespace: matlab.io.datastore
Partition file-set object
Syntax
subfs = partition(fs,n,index)
Description
partitions file set subfs
= partition(fs
,n
,index
)fs
into the number of parts specified by
n
and returns the partition corresponding to the index
index
.
Input Arguments
Examples
Partition File-Set Object and Get One Partition
Create a file-set object, partition the file-set object, and get the files contained in a specified partition.
Create a file-set object for all .mat
files in a
folder.
folder = fullfile(matlabroot,'toolbox','matlab','demos'); fs = matlab.io.datastore.DsFileSet(folder,'FileExtensions','.mat');
Partition the 40
files into five partitions and obtain the
first partition. Then, get the file information of all files in the first
partition.
subfsA = partition(fs,5,1) % first 8 files
subfsA_fileInfo = resolve(subfsA)
Obtain the second partition and files information for files in this partition.
subfsB = partition(fs,5,2) % next 8 files
subfsB_fileInfo = resolve(subfsB)
Tips
Use the
NumFiles
property of theDsFileSet
object to find the number of files infs
and use that number to estimate a reasonable number of partitions for the datastore.
Version History
Introduced in R2017b