stateVector.extract

Only include specified variables in a state vector


Syntax



Description

obj = obj.extract(v)
obj = obj.extract(variableNames)

Extracts the specified variables from the state vector. All unspecified variables are removed from the updated state vector.


Input Arguments

v

logical vector | linear indices
The indices of variables in the state vector that should be extracted. Either a logical vector with one element per state vector variable, or a vector of linear indices.

variableNames

string vector
The names of variables in the state vector that should be extracted.

Output Arguments

obj

scalar stateVector object
The state vector updated to only include the extracted variables.