Main Content

populateFoldersFromLocation

Class: matlab.io.datastore.FoldersPropertyProvider
Namespace: matlab.io.datastore

Populate Folders property from datastore location argument

Since R2020a

Syntax

populateFoldersFromLocation(ds,location)

Description

populateFoldersFromLocation(ds,location) populates the Folders property of the datastore ds using the location input to the datastore.

If your custom datastore class inherits from matlab.io.datastore.FoldersPropertyProvider, then you can call populateFoldersFromLocation in the datastore constructor of the class to populate the Folders property.

Input Arguments

expand all

Datastore, specified as a datastore object that inherits from matlab.io.datastore.FoldersPropertyProvider. To create a datastore object, see matlab.io.Datastore.

Location of files or folders in datastore, specified as one of these values:

  • A character vector listing a valid folder, file, or wildcard name.

  • A string array or cell array of character vectors containing valid folder, file, or wildcard names.

  • A matlab.io.datastore.DsFileSet object

Attributes

Accessprotected

To learn about attributes of methods, see Method Attributes.

Examples

expand all

If your custom datastore class inherits from matlab.io.datastore.FoldersPropertyProvider to add support for a Folders property, then you can use the populateFoldersFromLocation method in the datastore constructor to populate the Folders property.

For example, the datastore constructor used in the example Develop Custom Datastore for DICOM Data uses the populateFoldersFromLocation method to populate the Folders property:

        function myds = DICOMDatastore(location)
            % The class constructor to set properties of the datastore. 
            myds.Files = matlab.io.datastore.FileSet(location, ...
                "IncludeSubfolders", true);
            populateFoldersFromLocation(myds,location);
            reset(myds);
        end

Version History

Introduced in R2020a