Find the workspace ensemble member indices for members that match a specified variable name and value
findIndex is a function used in code generated by Diagnostic Feature
For example, when you specify
filename identifies the last file read from an ensemble datastore,
findIndex finds the index of the workspace ensemble member that is
associated with that file name.
The input data is a file or simulation ensemble datastore.
The computation option during code generation specified storing results in local memory rather than writing results back to the ensemble datastore.
Explicitly specifying a member index when reading and writing within the
local version of the data, which the code manages using a
workspaceEnsemble object, ensures member synchronization with the original
ensemble datastore. This synchronization is necessary when you have sequential
member-processing loops, such as when you compute ensemble statistics as a precursor to
computing signal residues.
During the first member-processing loop, which starts with an empty ensemble, no indexing is needed. The code appends each new member result to the end of the ensemble.
During the second loop, the index enables the code to write updated member results to the correct location within the now-populated ensemble.
For more information about the dual processing loop for ensemble statistics, see Anatomy of App-Generated MATLAB Code.
wensemble— Ensemble object
Ensemble object, specified as a
wensemble contains ensemble
data and specifies variable names and types.
varname— Variable name
Variable name to match, specified as a string.
value— Variable value
Variable value to match, specified as a string.
index— Member index
Member index for ensemble members that contain a specified variable name and value,
returned as a vector of positive integers with length equal to the number of matching
members. If no members contain the specified name-value combination,
. In code generated by
Diagnostic Feature Designer,
index is either a single integer or
identifies the member with the file name that matches the file name in the input