필터 지우기
필터 지우기

How to retrieve specific compartment in Simbiology model by name?

조회 수: 2 (최근 30일)
Colin Phipps
Colin Phipps 2016년 10월 19일
댓글: Colin Phipps 2016년 10월 19일
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.

채택된 답변

Arthur Goldsipe
Arthur Goldsipe 2016년 10월 19일
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
Colin Phipps
Colin Phipps 2016년 10월 19일
Thanks so much Arthur for the answer and for incorporating 'turtle' into the response!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

커뮤니티

더 많은 답변 보기:  SimBiology Community

카테고리

Help CenterFile Exchange에서 Extend Modeling Environment에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by