This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

rename (compartment, parameter, species, reaction)

Rename object and update expressions

Syntax

rename(Obj, 'NewNameValue')

Arguments

ObjCompartment, parameter, species, or reaction object.
'NewNameValue'Specify the new name.

Description

rename(Obj, 'NewNameValue'), changes the Name property of the object, Obj to NewNameValue and updates any uses of it in the model such as rules, events, reactions, variants, and doses to use the new name.

If the new name is already being used by another model component, the new name will be qualified to ensure that it is unique. For example if you change a species named A to K, and a parameter with the name K exists, the species will be qualified as CompartmentName.K to indicate that the reference is to the species. If you are referring to an object by its qualified name, for example CompartmentName.A and you change the species name, the reference will contain the qualified name in its updated form, for example, CompartmentName.K

When you want to change the name of a compartment, parameter, species, or reaction object, use this method instead of set.

Note

The set method only changes the Name property of the object, except for species and compartments. The method updates the species or compartment object's Name property and any reaction strings referring to the species or compartment to use the new name.

Examples

  1. Create a model object that contains a species A in a rule.

    m = sbiomodel('cell');
    s = addspecies(m, 'A');
    r = addrule(m, 'A = 4');
    
  2. Rename the species to Y

    rename(s, 'Y');
  3. See that the rule expression is now updated.

    r
    
    SimBiology Rule Array
    
    Index:    RuleType:            Rule:
    1         initialAssignment    Y = 4

See Also

set

Introduced in R2008b