stateVector.total
Take the sum total over dimensions of variables in a state vector
Syntax
Description
Updates the settings for totals for the listed variables. If the first input is -1, applies the settings to all variables currently in the state vector.
obj = obj.total(variables, stateDimension)
Takes the sum total over the indicated state dimension. The total is taken over all elements of the dimension that are included in the state vector (i.e. over all state indices for the dimension).
Takes a sum total over the indicated ensemble dimension. The total is implemented using the specified total indices. The total for the dimension is calculated over elements located by applying the total indices to particular elements along the dimension. If the dimension does not have a sequence, the total indices are applied to the reference element. If the dimension has a sequence, applies the total indices to each individual sequence element.
Takes the sum total over multiple dimesions. If every listed dimension is a state dimension, you do not need to provide the third input (the total indices). Specify total indices if the dimensions list contains any ensemble dimensions. Use an empty array for the indices of any state dimensions.
Specify how to treat NaN elements along each dimension. Default is to include NaN values.
obj = obj.total(variables, dimensions, “none”)
Discards any previously-specified options for taking a total for the listed dimensions. No total will be taken over the dimensions when building state vector ensembles.
obj = obj.total(variables, dimensions, “unweighted”)
Discards any previously-specified weights for use in a weighted total for the listed dimensions. The state vector will still take a total over the listed dimensions, but the total will be unweighted. This option is only valid for dimensions that take either a total or a weighted total. The dimensions list should not include dimensions that do not take a total at all.
Input Arguments
v
variableNames
dimensions
indices
The total indices show how to locate elements used in a sum total over an ensemble dimension. If the dimension does not use a sequence, the total indices are added to the reference element of each ensemble member. The total is then taken over the resulting data elements. If the dimension uses a sequence, a total will be taken over each sequence element. First, sequence indices are added to the reference element to give a set of sequence elements. Then, the total indices are added to each sequence element and a total is taken over each set of resulting data elements.
If a single dimension is listed, and the dimension is a state dimension, you do not need to provide total indices as an input. If the single dimension is an ensemble dimension, you may provide the total indices directly as a vector, rather than in a scalar cell. However, the scalar cell syntax is also permitted.
omitnan
[true|”omitnan”]: Omit NaN values when taking totals
[false|”includenan” (default)]: Include NaN values in totals.