Specify name of object
Name property identifies a SimBiology® object. Compartments, species, parameters, observables, and model objects can be
referenced by other objects using the
Name property, therefore
Name must be unique for these objects. However, species names need only
be unique within each compartment. Parameter names must be unique within a model (if at the
model level), or within each kinetic law (if at the kinetic law level). This means that you
can have nonunique species names if the species are in different compartments, and nonunique
parameter names if the parameters are in different kinetic laws or at different levels. Note
that having nonunique parameter names can cause the model to have shadowed parameters and that
may not be best modeling practice.
Use the function
sbioselect to find an object
with the same
Name property value.
In addition, note the following constraints and reserved characters
Name property in objects:
Model and parameter names cannot be empty, the word
time, all whitespace, or contain the characters
Compartment and species names cannot be empty, the word
null, the word
timeor contain the characters
However, compartment and species names can contain the words
timewithin the name, such as
Reaction, event, and rule names cannot be the word
timeor contain the characters
If you have a parameter, a species, or compartment name that is not a valid MATLAB® variable name, when you write an event function, an event trigger, a reaction, reaction rate equation, or a rule you must enclose that name in brackets. For example, enclose
[DNA polymerase+]in brackets. In addition, if you have the same species in multiple compartments you must qualify the species with the compartment name, for example,
[nuclear complex].[DNA polymerase+].
|Applies to||Objects: abstract kinetic law, configuration set, compartment, event, kinetic law, model, observable, parameter, reaction, RepeatDose, rule, ScheduleDose, species, unit, or variant|
|Data type||Character vector|
|Data values||Any character vector except reserved words and characters|
Create a model object named
modelObj = sbiomodel ('my_model');
Add a reaction object to the model object. Note the use of brackets because the names are not valid MATLAB variable names.
reactionObj = addreaction(modelObj, '[Aspartic acid] -> [beta-Aspartyl-PO4]')
SimBiology Reaction Array Index: Reaction: 1 [Aspartic acid] -> [beta-Aspartyl-PO4]
Set the reaction
set (reactionObj, 'Name', 'Aspartate kinase reaction'); get (reactionObj, 'Name')
ans = Aspartate kinase reaction
R2022b: Having duplicate model component names issues a warning
SimBiology issues a warning if multiple model components (model, compartment, species, parameter, reaction, rule, event, observable, dose, and variant) have the same name. In a future release, within a single model, these components will be required to have unique names even when they are of different types with the following two exceptions:
Species in different compartments can have the same name.
Parameters can have the same name if they are scoped to different parents. Specifically, you can use the same name for a model-scoped parameter and reaction-scoped parameters, where each reaction-scoped parameter belongs to a different reaction.
The purpose of this naming restriction is to ensure that every model component can be unambiguously referenced by its unique name within a model. For details on how to reference model component names in expressions, see Guidelines for Referencing Names in Expressions.
To disambiguate duplicate names from your model, use the
updateDuplicateNamesfunction at the command line. The function takes in a SimBiology model as an input and updates the component names as necessary. You can also specify optional outputs, such as a logical flag to check whether any update occurred, a list of model changes, and a copy of the original model before any updates were made.
updateDuplicateNamesfunction disambiguates the duplicate names by adding a suffix
"_N", where N is the first positive integer that results in a unique name. If there is an existing suffix, N will be incremented from that suffix. For example, if there are two model components named x_3, the function updates one of the names to x_4. If the existing suffix has leading zeros, the function omits the zeros in the new name. For instance, if x_003 is a duplicate name, it gets renamed to x_4. However, the function assumes that names with leading zeros and without leading zeros are different. For instance, x_005 and x_5 are considered to be different names.
R2022a: Having duplicate model component names will not be allowed in a future release
SimBiology will not allow you to have duplicate names for model components within a model.