Main Content

writeMember

Write data to a specific workspace ensemble member

Since R2020a

Description

writeMember is a function used in code generated by Diagnostic Feature Designer.

writeMember(wensemble,data) creates a new member in workspace ensemble wensemble, and appends data to the data set that wensemble references.

writeMember(wensemble,data,index) writes data to the ensemble member that index identifies. writeMember overwrites the data in existing variables and creates additional columns for new variables.

Code that is generated by Diagnostic Feature Designer uses writeMember, readMember, and findIndex under the following conditions:

  • The input data is an ensemble datastore, such as 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.

Input Arguments

collapse all

Ensemble object, specified as a workspaceEnsemble object. wensemble contains ensemble data and specifies the variable names and types within the ensemble, such as data variables and condition variables.

Member data, specified as a single-row table.

Member index, specified as a positive integer. index identifies the ensemble member to write new data to. If you omit index, writeMember appends data as a new ensemble member in wensemble.

Version History

Introduced in R2020a