Main Content

readByIndex

Class: matlab.io.datastore.BackgroundDispatchable
Namespace: matlab.io.datastore

(Not recommended) Return observations specified by index from datastore

readByIndex is not recommended. For more information, see Compatibility Considerations.

Syntax

[data,info] = readByIndex(ds,ind)

Description

[data,info] = readByIndex(ds,ind) returns a subset of observations in a datastore, ds. The desired observations are specified by indices, ind.

Input Arguments

expand all

Input datastore, specified as a Datastore object.

Indices of observations, specified as a vector of positive integers.

Output Arguments

expand all

Observations from the datastore, returned as a table or an array according to the read method of the datastore. For example, when ds is a custom mini-batch datastore, then data is a table with the same format as returned by the read (MiniBatchable) method.

Information about read data, returned as a structure array. The structure array can contain the following fields.

Field NameDescription
FilenameFilename is a fully resolved path containing the path string, name of the file, and file extension.
FileSize

Total file size, in bytes. For MAT-files, FileSize is the total number of key-value pairs in the file.

Attributes

Abstracttrue
AccessPublic

To learn about attributes of methods, see Method Attributes.

Tips

Version History

Introduced in R2018a

collapse all