matlab.io.datastore.DsFileSet.maxpartitions - Maximum number of partitions - MATLAB (original) (raw)

Main Content

Class: matlab.io.datastore.DsFileSet
Namespace: matlab.io.datastore

Maximum number of partitions

Syntax

N = maxpartitions(fs)

Description

[N](#d126e443338) = maxpartitions([fs](#mw%5Fe3d87b95-dec9-4a02-bca8-cf0caf462b3d)) returns the maximum number of partitions for a given DsFileSet objectfs.

Input Arguments

Output Arguments

expand all

N — Number of partitions

positive integer

Number of partitions, returned as an integer. The value ofN depends on the FileSplitSize property of the DsFileSet object.

Examples

Get Maximum Number of Partitions for the File-Set Object

Create a file-set object and get the number of partitions for different values of the FileSplitSize property.

Create a file-set object for all .mat files in a folder and check the number of files.

folder = fullfile(matlabroot,'toolbox','matlab','demos');
fs = matlab.io.datastore.DsFileSet(folder,'FileExtensions','.mat'); fs.NumFiles

The FileSplitSize property of the DSFileSet object is set to 'file'. Therefore,maxpartitions returns a value equal to the number of files.

Set the FileSplitSize property to a numeric size (2000 bytes) and compute maxpartitions.

fs = matlab.io.datastore.DsFileSet(folder,... 'FileExtensions','.mat',... 'FileSplitSize',2000); n = maxpartitions(fs)

Version History

Introduced in R2017b