Main Content


Rename object and update expressions


rename(Obj, 'NewNameValue')


ObjAbstractkineticlaw, compartment, event, kinetic law, model, parameter, RepeatDose, reaction, rule, ScheduleDose, species, unit, unitprefix, variant, or observable object.
'NewNameValue'Specify the new name.


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.


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.


  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.

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

See Also


Version History

Introduced in R2008b