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 件のコメント

Arthur Goldsipe
Arthur Goldsipe 2021 年 2 月 12 日
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 ExchangeExtend 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