MATLAB Answers

SImbiology: access "Initial Conditions" (not InitialValues)

16 views (last 30 days)
Domenico Bullara
Domenico Bullara on 11 Feb 2021
Commented: Arthur Goldsipe on 12 Feb 2021
when I use the getequations command on a simbiology model object, I get a section titled "Initial Conditions" that reports the initial values for all the variables calculated after any initial assignment rule. How can I directly access these values (i.e. read or use them to define other variables in my code) without having to manually copy/pasting them from the output lines?
P.S. Notice that this "Initial Condition" is NOT the InitialValue specified for the variables: for several different reasons, I for example often assign a default value 0 to the InitialValue of all the variable and calculate the appropriate initial condition via an initial assignment rule. When I access the InitialValue property of the species (which I know how to do) I will always therefore get 0, but if I use the getequations command the output shows the right initial condition (the one calculated by the rule).

Answers (1)

Arthur Goldsipe
Arthur Goldsipe on 12 Feb 2021
As you discovered, getequations is intended as a textual report and is not well suited for programmatic access to initial values. There is not currently a documented way to get these values programmatically, but I will add that to the SimBiology enhancement database. In the meantime, one workaround would be to perform a simulation with StopTime set to 0 and inspect the simulation results. This may also require you to update StatesToLog to ensure that the relevant components are reported in the simulation results.
  1 Comment
Arthur Goldsipe
Arthur Goldsipe on 12 Feb 2021
Also, if the above workaround is not acceptable, please contact me directly. I may be able to privately share a prototype for programmatically accessing this data.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by