StatesToLog

Specify species, compartment, or parameter data recorded

Description

The StatesToLog property specifies the species, compartment, or parameter data to log during a simulation. This is the data returned in x during execution of [t,x] = sbiosimulate(modelObj). By default, all species, nonconstant compartments, and nonconstant parameters are logged.

Characteristics

Applies toObject: RuntimeOptions
Data typeString, cell array of strings, object or vector of objects
Data valuesSpecies objects, compartment objects, or parameter objects. Default is all, which means all species objects, all compartment objects whose ConstantCapacity = false, and all parameter objects whose ConstantValue = false.
AccessRead/write

Examples

expand all

Specify a List of Species to be Logged During Simulation

Load the Lotka-Volterra Model.

sbioloadproject lotka;

Get the configset object of the lotka model m1.

configset = getconfigset(m1);

Display the list of species whose data are logged by default during the simulation.

configset.RuntimeOptions.StatesToLog
   SimBiology Species Array

   Index:    Compartment:    Name:    InitialAmount:    InitialAmountUnits:
   1         unnamed         x        1                 
   2         unnamed         y1       900               
   3         unnamed         y2       900               
   4         unnamed         z        0                 

Suppose you want to log just species y1 and y2 data. You can specify their names as a cell array of strings and set it to StatesToLog property.

configset.RuntimeOptions.StatesToLog = {'y1','y2'};

Confirm the setting.

configset.RuntimeOptions.StatesToLog
   SimBiology Species Array

   Index:    Compartment:    Name:    InitialAmount:    InitialAmountUnits:
   1         unnamed         y1       900               
   2         unnamed         y2       900               

Alternatively, you can specify an array of species objects (instead of strings) to StatesToLog property.

y1 = m1.Species(2);
y2 = m1.Species(3);
configset.RuntimeOptions.StatesToLog = [y1, y2];

Simulate and plot the results. Notice that simulation results of only y1 and y2 are plotted.

sbioplot(sbiosimulate(m1));

To reset to the default list, set StatesToLog to a string 'all'.

configset.RuntimeOptions.StatesToLog = 'all';

Simulate again. Notice all the species data are plotted.

sbioplot(sbiosimulate(m1));

Do not specify 'all' as a cell string such as {'all'}. If so, SimBiology interprets it as a species named all.

Was this topic helpful?