how to delete (all) Requirement Traceability links of Stateflow transition-lines by command

조회 수: 3 (최근 30일)
Hello,
I want to delete all Requirement Traceabilities of the stateflow transition-lines by command (they are too many, it so suffering to delete one by one manually)
all my efforts only reach bellows
1. % remove the Requirement-links
set_param(#Targtet#, 'RequirementInfo', '');
2. % get all stateflow transitions
S = sfroot;
myModel = S.find('-isa', 'Simulink.BlockDiagram', '-and', 'Name', bdroot);
charts = myModel.find('-isa', 'Stateflow.Chart');
charts.find('-isa', 'Stateflow.Transition') % ans = Stateflow.Transition: 55-by-1
BTW: I know I could select several lines and delete at once, while it helps few for my very-complicated model.
Thanks to all reviewing/answering it.

채택된 답변

Gautam
Gautam 2020년 5월 22일
I'm assuming that you have your 55x1 array of transition objects with you. Post that you can use 'rmi' API to programmatically handle requirements. Here's a doc link: https://www.mathworks.com/help/slrequirements/ref/rmi.html#d120e5121
Continuing your code, assuming all 55x1 transitions are in a variable tr:
tr = charts.find('-isa', 'Stateflow.Transition') % ans = Stateflow.Transition: 55-by-1
for i=1:length(tr)
current_object = tr(i);
if(rmi('count',current_object)~=0) %Check if no of requirements linked to the transition is nonzero
rmi('clearAll', current_object,'noprompt') % Delete the requirements without throwing a dialog prompt
end
end
You can use rmi and automate this process for other stateflow objects like states as well.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Stateflow Programmatic Interface에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by