stateVector.couple

Couple variables in a state vector


Syntax



Description

obj = obj.couple
obj = obj.couple(-1)

Couples all the variables in the state vector to one another. Coupled variables are required to have matching metadata within ensemble members of a state vector ensemble. This ensures that, within an ensemble member, the data from different variables all align to the same point. By default, all variables in a state vector are automatically coupled to one another, so this method is only necessary if you have previously disabled autocoupling.

When the ensemble dimensions of a variable are changed, the ensemble dimensions of coupled variables will be updated to match. Note that this update does not copy reference/state indices across variables. Only the status of a dimension as an ensemble/state dimension is updated. For this syntax, the first variable in the state vector is used as a template variable; the ensemble dimensions and autocoupling settings of all other variables will be updated to match those of the template.

obj = obj.couple(v)
obj = obj.couple(variableNames)

Couples the listed variables to one another. Coupling is transitive, so any unlisted variables that are already coupled to the listed variables will also be coupled. The first listed variable is used as the template variable; the ensemble dimensions and autocoupling settings of all variables being coupled will be updated to match this template.

obj = obj.couple(variables, t)
obj = obj.couple(variables, templateName)

Specify the variable to use as a template. All listed variables, as well as unlisted variables already coupled to the listed variables, will be coupled to this template. The ensemble dimensions and autocoupling settings of all variables being coupled will be updated to match this template.


Input Arguments

v

logical vector | linear indices | -1
The indices of variables in the state vector that should be coupled. Either a logical vector with one element per state vector variable, or a vector of linear indices. If -1, selects all variables in the state vector.

variableNames

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

t

logical vector | linear index
The index of a variable that should be used as the coupling template.

templateName

string scalar
The name of a variable that should be used as the coupling template.

Output Arguments

obj

scalar stateVector object
The state vector with updated coupled variables.