stateVector.add

Adds variables to a stateVector


Syntax



Description

obj = obj.add(variableNames, grid)

Adds variables to a state vector and specifies a single .grid file that contains the data for all the different variables.

obj = obj.add(variableNames, grids)

Specify different .grid files for the variables being added to the state vector. Each .grid file should contain the data for the corresponding new variable. You may repeat .grid files when several state vector variables are derived from the same .grid file.

obj = obj.add(…, autocouple)

Specify auto-coupling settings for the new variables. Use true, “a”, “auto”, or “automatic” to automatically couple the new variables to existing variables in the state vector (default); note that the new variables will not be coupled to existing variables that have autocoupling disabled. Use false, “m”, “man”, or “manual” to disable autocoupling.

If autocouple has a single element, applies the same setting to all of the new variables. Otherwise, autocouple should have one element per new variable. Each element indicates the desired setting for the correpsonding variable. This vector syntax allows you to use different settings for different variables.


Input Arguments

variableNames

string vector [nVariables]
The names of the new variables being added to the state vector. Variable names DO NOT need to match the names of variables in data source files. Use any name you find meaningful. Names cannot duplicate the names of variables already in the state vector.

Variable names must be valid MATLAB variable names. They must 1. start with a letter, 2. only contain numbers, letters, and underscores, and 3. cannot match a MATLAB keyword.

grid

string scalar | scalar gridfile object
A .grid file that contains the data for all the newly added variables. Either a gridfile object, or the filepath to a .grid file. The .grid file must have at least one dimension.

grids

vector [nVariables], string | gridfile
The collection of .grid files that contain the data for the new variables. Must have one element per new variable. May either be a vector of gridfile objects, or .grid filepaths.

autocouple

vector [nVariables], logical | string
Indicates the autocoupling setting to use for each new variable. If autocouple has a single element, applies the same setting to all the new variables.

[true|”a”|”auto”|”automatic” (Default)]: Automatically couple new variable to existing, auto-couple enabled variables.

[false|”m”|”man”|”manual”]: Disable autocoupling for the new variable


Output Arguments

obj

scalar stateVector object
The stateVector object updated to include the new variables.