SimBiology getConfigSet does not recognise model object

조회 수: 1 (최근 30일)
Hi,
I am trying to change the simulation settings of my Simbiology model through a Matlab script. I use the following code:
modelObj=sbioloadproject('RandomNetwork_5')
cs = getConfigSet(modelObj,'active');
However I get the following error:
Error using getConfigSet (line 10)
The first input to get_param must be of type 'double', 'char' or 'cell'.
I have no idea of what might be going wrong here and would appreaciate some help. I attach the .sbproj file in case it is of any use.
Many thanks,
Alvaro

채택된 답변

Florian Augustin
Florian Augustin 2019년 6월 28일
편집: Florian Augustin 2019년 6월 28일
Hi Alvaro,
I think you are seeing an unfortunate naming collision. SimBiology's method is getconfigset (all lower-case). The method getConfigSet is a method in Simulink. The following should work:
s=sbioloadproject('RandomNetwork_5')
cs = getconfigset(s.m1, 'active');
Best,
-Florian
Edited answer:
Updated the code snippet after reading Jérémy's comment to account for sbioloadproject returning a structure.
  댓글 수: 2
Jeremy Huard
Jeremy Huard 2019년 6월 28일
+1, good catch!
Alvaro Martinez Guimera
Alvaro Martinez Guimera 2019년 6월 28일
Aha! These were exactly the issues. Thank you very much Jeremy and Florian!

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

추가 답변 (1개)

Jeremy Huard
Jeremy Huard 2019년 6월 28일
Hi Alvaro,
sbioloadproject will return a struct that contains your model(s).
This should work:
s = sbioloadproject('RandomNetwork_5');
modelObj = s.m1;
cs = getConfigSet(modelObj,'active');
Best,
Jérémy

커뮤니티

더 많은 답변 보기:  SimBiology Community

카테고리

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

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by