MATLAB Answers

How to change model parameter value in exported simbiology model?

9 views (last 30 days)
I need to change the model parameter value in exported simbiology model. How can do it in command mode?

  0 Comments

Sign in to comment.

Accepted Answer

Sietse Braakman
Sietse Braakman on 18 Jul 2019
Hi Rajeev,
To clarify - there are two ways I can interpret your question primarily because 'exporting' a SimBiology model can mean two things:
  1. You can export the SimBiology model from the SimBiology Desktop to the MATLAB Workspace, by right clicking on the model and selecting "Export to Model to Workspace..."
  2. You can export a SimBiology model by calling the function 'export' on a SimBiology model. This exports the model for standalone and deployment applications.
If you meant the first form of exporting, and assuming your SimBiology model is now in your MATLAB workspace in a variable called m1, you can access the parameters as follows:
>> params = sbioselect(m1,'Type','parameter');
This will yield a SimBiology Parameter array:
SimBiology Parameter Array
Index: Name: Value: ValueUnits:
1 ka_Central 1 1/hour
2 Cl_Central 1 liter/hour
3 ke_Central 1 1/hour
4 absorption rate 1 milligram/hour
Say you now want to change the Value of ke_Central to 2, you can use the following command:
>> params(4).Value = 2;
If and only if all your parameters are model scoped, you can also access the parameters using
>> modelscopedparameters = m1.Parameters;
If you meant the second scenario, things are a bit more complicated and there is no easy way to change parameter values. As an alternative to the 'exported SimBiology object', you could consider using a SimFunction.
Let me know if that helps.
Best,
Sietse

  3 Comments

Rajeev Kumar
Rajeev Kumar on 22 Jul 2019
Hi Siestse,
Thanks very for the detailed clarification. This is really helpful. However currently I working with exported model ( that is I am loading the exported model ) and needs to do two things :
  1. Specifying the doses for the simulations ( There is no issue in doing it)
  2. I want my model scoped parameters to change with the different drug. sbioselect and m1.Parameters does not work with exportedModel
Is any workaround to to change the model parameters. I am trying to do the fitting the parameters where I have to change the model model parameters depending the different drugs. Can you suggest others ways to implement it if I can not change the model parameters value in exportedModel.
Best Regards,
Rajeev
Rajeev Kumar
Rajeev Kumar on 23 Jul 2019
Thanks Sietse for providing the relevant solution. I guess simfunction and your suggestion may work for me. I will let you know after the implementation.
Best Regards,
Rajeev

Sign in to comment.

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!