isSubsettable - Determine whether datastore is subsettable - MATLAB (original) (raw)

Determine whether datastore is subsettable

Since R2022b

Syntax

Description

tf = isSubsettable([ds](#mw%5Fb0ade1fd-6df2-4f6d-95bd-cd80b75e0299)) returns logical1 (true) if the datastore is able to be subsetted. If the datastore is not subsettable, the result is logical 0 (false). Datastores containing underlying datastores, such asTransformedDatastore, CombinedDatastore, andSequentialDatastore, are subsettable only when all underlying datastores are subsettable.

example

Examples

collapse all

Create an image datastore for the image files in a sample folder. Then, write an if/else statement that subsets the datastore only if it is subsettable.

folders = fullfile(matlabroot,"toolbox","matlab",["demos",fullfile("matlab_images",["png","tiff"])]); exts = [".jpg",".png",".tif"]; imds = imageDatastore(folders,"LabelSource","foldernames","FileExtensions",exts);

Write an if/else statement that subsets the datastore only if it is subsettable.

if isSubsettable(imds) newds = subset(imds,2); disp("Subset successful.") else disp("Datastore is not subsettable.") end

Input Arguments

collapse all

Input datastore. You can use these datastores as input:

Extended Capabilities

expand all

Usage notes and limitations:

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

Version History

Introduced in R2022b