Main Content

removevariant(模型)

Remove variant from model

Syntax

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

Arguments

modelObj Specify theModel objectfrom which you want to remove the variant.
variantObj Specify theVariant objectto return from the model object.

Description

variantObj= removevariant(modelObj, 'NameValue')removes a SimBiology®variant object with the nameNameValuefrom the model objectmodelObjand returns the variant object tovariantObj. The variant objectParentproperty is assigned[](empty).

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

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

To view the variants stored on a model object, use thegetvariantmethod. To copy a variant object to another model, usecopyobj. To add a variant object to a SimBiology model, use theaddvariantmethod.

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