필터 지우기
필터 지우기

Cycle through components according to stereotype

조회 수: 2 (최근 30일)
Loic
Loic 2023년 6월 12일
편집: Josh Kahn 2023년 6월 13일
Hello,
I am investigating System Composer scripting, and I am looking for a way to cycle through every component that verifies the condition :
( Component.getStereotype(SoughtAfterStereotype) = true)
To then modify a property of said stereotype.
At this point I am investigating the forums and documentation, but couldn't find a way to cycle through every component of a model, to then check the condition.
Thank you very much in advance for your help !

채택된 답변

Josh Kahn
Josh Kahn 2023년 6월 13일
편집: Josh Kahn 2023년 6월 13일
Hi @Loic,
System Composer has a query feature that is optimized for these kinds of search tasks. The API list for the query language can be found at the link below:
and more specific to your task, the PropertyValue constraint:
Here is something to get you started:
mdl = systemcomposer.loadModel('MyArchitecture')
[~, components] = find(mdl, systemcomposer.query.PropertyValue("Profile.Stereotype.Property1")==true)
arrayfun(@(component) setProperty(component, 'Profile.Stereotype.Property1', 'false'), components)
Please reach out if you have any other questions.
Regards,
Josh

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 System Composer에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by