Main Content

addcontent (variant)

Append content to variant object


addcontent(variantObj, contents)
addcontent(variantObj1, variantObj2)


variantObjSpecify the variant object to which you want to append data. The Content property is modified to add the new data.

Specify the data you want to add to a variant object. Contents can either be a cell array or an array of cell arrays. A valid cell array should have the form {'Type', 'Name', 'PropertyName', PropertyValue}, where PropertyValue is the new value to be applied for the PropertyName. Valid Type, Name, and PropertyName values are as follows.

'species'Name of the species. If there are multiple species in the model with the same name, specify the species as [compartmentName.speciesName], where compartmentName is the name of the compartment containing the species.'InitialAmount'
'parameter'If the parameter scope is a model, specify the parameter name. If the parameter scope is a kinetic law, specify [reactionName.parameterName].'Value'
'compartment'Name of the compartment.'Capacity'


addcontent(variantObj, contents) adds the data stored in the variable contents to the variant object (variantObj).

addcontent(variantObj1, variantObj2) appends the data in the Content property of the variant object variantObj2 to the Content property of variant object variantObj1.


Remember to use the addcontent method instead of using the set method on the Content property because the set method replaces the data in the Content property, whereas addcontent appends the data.


  1. Create a model containing one species.

    modelObj = sbiomodel('mymodel');
    compObj = addcompartment(modelObj, 'comp1');
    speciesObj = addspecies(compObj, 'A');
  2. Add a variant object that varies the InitialAmount property of a species named A.

    variantObj = addvariant(modelObj, 'v1');
    addcontent(variantObj, {'species', 'A', 'InitialAmount', 5});

Version History

Introduced in R2007b