Clear Filters
Clear Filters

Export model to workspace - missing dose

4 views (last 30 days)
I'm trying to export to the workspace the model attached using the "Export Model to Workspace" button. When I do that, and check the model exported in the workspace, I cannot find the repeated dose applied to the Central.Drug_Central species. I'm probably missing sometimes obvious but can't figure out what exactly.
Many thanks,

Accepted Answer

Jeremy Huard
Jeremy Huard on 16 Jun 2020
Edited: Jeremy Huard on 16 Jun 2020
Hi Jacopo,
doses are indeed included in the model.
You can retrieve them using the method getdose. getdose will return all doses in the model if you don't provide any dose name. If you do, it will return the dose with the name you specified. In your case, you could use the following command after exporting the model to the workspace:
dose = getdose(m1, 'dose_1')
Best regards,
Jacopo Biasetti
Jacopo Biasetti on 16 Jun 2020
Hi Jeremy,
Thanks for the answer. It, of course, works; but I still don't understand why the dose is not shown in the m1 tree, see attached image... am I missing something?
Jeremy Huard
Jeremy Huard on 16 Jun 2020
Hi Jacopo,
doses do not show up in the variable editor because it's a hidden property. Alos, our developers pointed out to me that calling getdose is the recommended workflow to retrieve doses from a model object, rather than using this hidden property. I have edited my previous answer accordingly.
That being said, we understand this can be confusing and might have to rethink this design. Thanks for your feedback!
Best regards,

Sign in to comment.

More Answers (1)

Sietse Braakman
Sietse Braakman on 16 Jun 2020
Edited: Sietse Braakman on 16 Jun 2020
Hi Jacopo,
When you export the model to the MATLAB workspace, by right clickin on the model in SimBiology and selecting 'Export Model to Workspace', you should get a variable m1 (default name) in the MATLAB workspace.
You can explore m1 on the MATLAB command line e.g.:
etc. If you type m1. and hit the <tab> button on your keyboard (don't forget the period after m1!) you can see all the different methods (starting with a lower case letter, e.g. adddose) you can apply to m1 and the different objects within m1 such as Species, Compartments, Events, Parameters etc. However, Doses and Variants will now show up in the tab-complete because they, together with variants, are a hidden property of a model.
You can also use the sbioselect function.
repeatdoses = sbioselect(m1, 'Type', 'repeatDose')
scheduledoses = sbioselect(m1,'Type','scheduleDose')
Let me know if that works for you.


More Answers in the  SimBiology Community


Find more on Scan Parameter Ranges in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!