how do I assign values to parameters in simbiology model from a .m file?

6 visualizzazioni (ultimi 30 giorni)
In my simbiology model, I can assign values to Species from a matlab file using the following syntax: m1.Species(5).InitialAmount = 10.0;
The above will assign 10 to the fifth species. How do I assign values using index to parameters? My model has about 14 parameters and once I try to assign a value to the 6th parameter, using following syntax, I get the following error:
m1.Parameters(6).Value = 0.01;
Index exceeds array bounds.
I appreciate your help.

Risposta accettata

Arthur Goldsipe
Arthur Goldsipe il 26 Ott 2018
I'm guessing that some of your parameters are scoped to reactions.
First, some background: In SimBiology, parameters can be "scoped" either to the model or to a specific reaction. A model-scoped parameter can be used in any reaction, rule, or event in the model. A reaction-scoped parameter can only be used in the reaction that it's scoped to, and it "shadows" any model-scoped parameter of the same name. This allows you to use the same parameter name (like "kf") in multiple reactions, even if the reactions have different parameter values.
m1.Parameters only lists model-scoped parameters. To access a reaction-scoped parameter, you normally go through the reaction, for example, m1.Reactions(1).KineticLaw.Parameters(1).
As an alternative that would work for either type of parameter, you can use sbioselect to find your parameters by name. For example, to find all parameters named "kf", you could use kf = sbioselect(m1, 'Name', 'kf', 'Type', 'parameter'). If there's only one parameter named "kf", then you can set it's value with kf.Value = 10.0.

Più risposte (0)

Community

Più risposte nel  SimBiology Community

Categorie

Scopri di più su Scan Parameter Ranges in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by