Main Content

getspecies (kineticlaw)

Get specific species in kinetic law object


speciesObj = getspecies(kineticlawObj)
speciesObj = getspecies(kineticlawObj, 'SpeciesVariablesValue')


kineticlawObjRetrieve species used by the kinetic law object.
SpeciesVariablesValueRetrieve species used by the kinetic law object corresponding to the specified species in the SpeciesVariables property of the kinetic law object.


speciesObj = getspecies(kineticlawObj) returns the species used by the kinetic law object kineticlawObj to speciesObj.

speciesObj = getspecies(kineticlawObj, 'SpeciesVariablesValue') returns the species in the SpeciesVariableNames property to speciesObj.

SpeciesVariablesValue is the name of the species as it appears in the SpeciesVariables property of kineticlawObj. SpeciesVariablesValue can be a cell array of character vectors.

Species names are referenced by reaction objects, kinetic law objects, and model objects. If you change the name of a species, the reaction updates to use the new name. You must, however, configure all other applicable elements such as rules that use the species, and the kinetic law object SpeciesVariableNames. Use the method setspecies to configure SpeciesVariableNames.


Create a model, add a reaction, and then assign the SpeciesVariableNames for the reaction rate equation.

  1. Create a model object, and then add a reaction object.

    modelObj = sbiomodel('my_model');
    reactionObj = addreaction(modelObj, 'a -> c + d');
  2. Create a kinetic law object for the reaction object, of the type 'Henri-Michaelis-Menten'.

    kineticlawObj = addkineticlaw(reactionObj, 'Henri-Michaelis-Menten');

    reactionObj KineticLaw property is configured to kineticlawObj.

  3. The 'Henri-Michaelis-Menten' kinetic law has one species variable (S) that should to be set. To set this variable:

    setspecies(kineticlawObj,'S', 'a');
  4. Retrieve the species variable using getspecies.

    speciesObj = getspecies (kineticlawObj, 'S')

    MATLAB returns:

    SimBiology Species Array
    Index:  Compartment: Name: InitialAmount: InitialAmountUnits:
       1      unnamed     a        0                     
Introduced in R2006a