ensembleMetadata.rows

Return the metadata for rows of a state vector ensemble


Syntax



Description

metadata = obj.rows(dimension)

Return metadata for each row of an ensemble. The first input indicates the dimension for which to return metadata. The dimension must be a state dimension for at least variable in the ensemble.

The returned metadata will have one row per state vector element (row) in the ensemble. If the metadata for the different variables cannot be concatenated, then returned metadata will be a cell column vector, and each element of the cell vector will hold the metadata for a particular row. If the metadata can be concatenated, then the method will concatenate the metadata and return it directly as an array. Typically, metadata values can only be concatenated if they have similar data types and if they have the same sizes along dimensions 2 and 3.

If a variable is missing the dimension, or does not use the dimension as a state dimension, then the method will use missing values for the rows of the variable. Missing values are NaN for numeric metadata, <missing> for string metadata, ‘ ‘ for char, and NaT for datetime. If logical metadata has missing values, the metadata is first converted to “single” and then NaN is used for the missing values. If the metadata for the variables is not compatible and returned as a cell vector, the contents of the cells of the missing elements will be NaN.

metadata = <strong>obj.metadata</strong>(0) Returns the name of the variable associated with each state vector element.

metadata = <strong>obj.metadata</strong>(dimension, rows) metadata = <strong>obj.metadata</strong>(dimension, -1) Return metadata at the specified rows of the state vector ensemble. If the second input is -1, selects all rows of ensemble. The returned metadata will have one row per selected state vector row.

metadata = <strong>obj.metadata</strong>(dimension, rows, cellOutput) metadata = <strong>obj.metadata</strong>(dimension, rows, false|”d”|”default”) metadata = <strong>obj.metadata</strong>(dimension, rows, true|”c”|”cell”) Specify whether output should always be returned as a cell. If false (default), metadata is returned directly as a matrix when the variables have compatible metadata. If true, metadata is always returned as a cell vector, even when variables have compatiable metadata.


Input Arguments

dimension

string scalar | 0
Indicates the dimension to return metadata for. The dimension must be a state dimension of at least one of the variables in the state vector. If 0, returns the names of variables at the specified rows.

rows

-1 | vector, linear indices | logical vector
Indicates which state vector rows to return metadata at. If -1, selects all rows in the state vector. If a logical vector, must match the length of the state vector.

cellOutput

string scalar | scalar logical
Indicates whether metadata should always be returned as a cell.

[“default”|”d”|false]: When the metadata for different variables is compatible and can be concatenated, returns the metadata directly as a matrix.

[“cell”|”c”|true]: Metadata is always returned as a cell vector


Output Arguments

metadata

matrix [nRows x ?] | cell vector [nRows] {metadata vector}
The metadata at the selected rows. Has one row per selected row. If the metadata values for different variables are compatible (and cellOutput is not set to true), returns the metadata directly as a matrix. Otherwise, returns metadata as a cell vector. Each element of the cell vector holds the metadata for the associated row. If the row implements a mean over the state dimension, the metadata for elements used in the mean is organized along the third dimension. If a row is not associated with the state dimension, returns NaN, NaT, or <missing> metadata as appropriate.