Main Content

removevariant (model)

Remove variant from model

Syntax

variantObj = removevariant(modelObj, 'NameValue')
variantObj = removevariant(modelObj, variantObj)

Arguments

modelObjSpecify the Model object from which you want to remove the variant.
variantObjSpecify the Variant object to return from the model object.

Description

variantObj = removevariant(modelObj, 'NameValue') removes a SimBiology® variant object with the name NameValue from the model object modelObj and returns the variant object to variantObj. The variant object Parent property is assigned [] (empty).

A SimBiology variant object stores alternate values for properties on a SimBiology model. For more information on variants, see Variant object.

variantObj = removevariant(modelObj, variantObj) removes a SimBiology variant object (variantObj) and returns the variant object variantObj.

To view the variants stored on a model object, use the getvariant method. To copy a variant object to another model, use copyobj. To add a variant object to a SimBiology model, use the addvariant method.

Examples

  1. Create a model containing several variants.

    modelObj = sbiomodel('mymodel');
    variantObj1 = addvariant(modelObj, 'v1');
    variantObj2 = addvariant(modelObj, 'v2');
    variantObj3 = addvariant(modelObj, 'v3');
  2. Remove a variant object using its name.

    removevariant(modelObj, 'v1');
  3. Remove a variant object using its index number.

    1. Get the index number of the variant in the model.

      vObjs = getvariant(modelObj)  
      SimBiology Variant Array
      
         Index:  Name:             Active:
         1       v2                false
         2       v3                false
    2. Remove the variant object.

      removevariant(modelObj, vObjs(2));

Version History

Introduced in R2007b