SImbiology: access "Initial Conditions" (not InitialValues)

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).

답변 (1개)

Arthur Goldsipe
Arthur Goldsipe 2021년 2월 12일

0 개 추천

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

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.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Extend Modeling Environment에 대해 자세히 알아보기

제품

질문:

2021년 2월 11일

댓글:

2021년 2월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by