Want to remove unused data/event from Stateflow

조회 수: 3 (최근 30일)
Vivek
Vivek 2017년 2월 14일
편집: Vivek 2017년 2월 17일
Hi Friends,
I want to remove the data/events declared in Stateflow in model properties (data dictionary) but not used in the logic. I know the M script command to get all the data/event declared in data dictionary but don't know how to find out whether it is used in Stateflow or not.
Is there any particular property to find it out. Please provide your suggestion on how to automate it.

채택된 답변

Michelle Wu
Michelle Wu 2017년 2월 16일
Stateflow can detect unused data, events, messages, and functions when the corresponding diagnostic is set to 'warning' or 'error'. However, please note that the diagnostic is only performed during a model update of the Stateflow Chart. If a Chart has not changed since a previous model update, the Chart will not be analyzed again, and as such the diagnostics are not shown. Please refer to the following documentation for more information:
It seems that the Stateflow API is not capable of directly removing these unused data or events. The only possible workaround you could try is to first let Simulink detect unused data and events, and then report the diagnostic messages programmatically. Afterwards, you might parse the error messages and remove those accordingly. The following documentation could be helpful:
  댓글 수: 1
Vivek
Vivek 2017년 2월 17일
편집: Vivek 2017년 2월 17일
Thanks. Actually it can be done by obtaining LabelString of all transitions and check the variable name against it. But I'm looking for some simpler solution.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by