isPartitionable - Determine whether datastore is partitionable - MATLAB (original) (raw)

Main Content

Determine whether datastore is partitionable

Since R2020a

Syntax

Description

tf = isPartitionable([ds](#mw%5Fa24d451f-3d99-4c9c-877a-cec0e69e12bf)) returns logical1 (true) if the datastore ds is partitionable. Otherwise, the result is logical 0 (false).

You can use the partition function on partitionable datastores to create partitions for parallel processing with Parallel Computing Toolbox™.

example

Examples

collapse all

Test Partitionability of Datastores

Create a TabularTextDatastore, and then write an if/else statement that partitions the datastore only if it is partitionable.

ttds = tabularTextDatastore('outages.csv'); if isPartitionable(ttds) newds = partition(ttds,3,1); disp('Partitioning successful.') else disp('Datastore is not partitionable.') end

Now create a CombinedDatastore object comprised of two copies of ttds. Use the same if/else test to partition the datastore.

cds = combine(ttds,ttds); if isPartitionable(cds) newds = partition(cds,3,1); disp('Partitioning successful.') else disp('Datastore is not partitionable.') end

Datastore is not partitionable.

In this case, the combined datastore cds is not partitionable because the underlying TabularTextDatastore objects do not have subset methods.

Create another CombinedDatastore object, but this time construct it out of ImageDatastore objects. In this case the combined datastore is partitionable because the underlying ImageDatastore objects have subset methods.

imageFiles = {'street1.jpg','street2.jpg','peppers.png','corn.tif'}; imds = imageDatastore(imageFiles); cds = combine(imds,imds); if isPartitionable(cds) newds = partition(cds,3,1); disp('Partitioning successful.') else disp('Datastore is not partitionable.') end

Input Arguments

collapse all

ds — Input datastore

datastore

Input datastore. You can use these datastores as input:

Extended Capabilities

Thread-Based Environment

Run code in the background using MATLAB® backgroundPool or accelerate code with Parallel Computing Toolbox™ ThreadPool.

Usage notes and limitations:

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

Version History

Introduced in R2020a