필터 지우기
필터 지우기

SimBiology calling a function

조회 수: 3 (최근 30일)
Richard Allen
Richard Allen 2014년 2월 26일
답변: Ingrid Tigges 2014년 3월 5일
I am familiar with the SimBiology functionality that allows calling a user defined MATLAB function. Is there a shorthand to pass all species to that function?
For example what I'm looking to be able to do is call:
P= myfunction(X,P,0.5);
rather than
P=myfunction(species1,species2,...,parameter1,parameter2,....)
where X is a vector with elements containing each species in the model, and P all the parameters.
Thanks for any help/suggestions!
Richard
  댓글 수: 1
Ingrid Tigges
Ingrid Tigges 2014년 2월 26일
Hello Richard, please contact technical support regarding your question and refer to Ingrid Tigges and your post on MATLAB Answers.

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

답변 (1개)

Ingrid Tigges
Ingrid Tigges 2014년 3월 5일
Have a look at the attached code. simbiology_ml_answers is the main script. The steps are as follows:
  • Get species names with
speciesNames = get(m1.Species, 'Name');
  • Build a string containing all species names
  • If you use your own function in a rule, put the string into the rule (with added information like the function name)
As you can see in the code there are some additional tweaks necessary to prevent things like algebraic loops.

커뮤니티

더 많은 답변 보기:  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