Effacer les filtres
Effacer les filtres

How to retrieve specific compartment in Simbiology model by name?

1 vue (au cours des 30 derniers jours)
Colin Phipps
Colin Phipps le 19 Oct 2016
Commenté : Colin Phipps le 19 Oct 2016
Given a Simbioloogy 'model' I can access/get a specific compartment object if I know the numerical index, e.g.
model.compartments(2)
shows me the 2nd compartment. I can get/set properties from this indexing. Say this compartment is named 'turtle'. Can I get this compartment object from the Name, instead of by index? Something like model.compartments('turtle'), or model.compartments('Name'=='turtle'). although clearly these won't work.

Réponse acceptée

Arthur Goldsipe
Arthur Goldsipe le 19 Oct 2016
Hi,
We made the sbioselect function for things like this, and even for more general kinds of searching. In this case, you could do the following:
sbioselect(model, 'Name', 'turtle', 'Type', 'compartment')
or if you're not worried about other things named 'turtle' you could just do this:
sbioselect(model, 'Name', 'turtle')
Take a look at the reference page for more examples.
  1 commentaire
Colin Phipps
Colin Phipps le 19 Oct 2016
Thanks so much Arthur for the answer and for incorporating 'turtle' into the response!

Connectez-vous pour commenter.

Plus de réponses (0)

Communautés

Plus de réponses dans  SimBiology Community

Catégories

En savoir plus sur Extend Modeling Environment dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by