- A state is a parent state or a substate based on its geometric location in the chart. For more information, see https://www.mathworks.com/help/stateflow/api/creating-and-destroying-api-objects.html
- States can output self-activity, child activity, and leaf activity, as described in https://www.mathworks.com/help/stateflow/ug/about-active-state-data.html.
How to check if state is parent state or substate ???
조회 수: 3 (최근 30일)
이전 댓글 표시
Dear bros !!!
When I use following code, OutputMonitoringMode of A1 and B are 'Self activity' and A is 'ChildActivity' coressponding.
states = charts(i).find('-isa', 'Stateflow.State', 'IsCommented', 0)
states(1).OutputMonitoringMode
So I can not defined that A1 is substate.
Do you know how to define it???
댓글 수: 0
답변 (1개)
Jorge Calvo
2021년 11월 2일
Hi,
I think you are confusing two different terms: whether a state is a parent/substate and what type of active state output it is producing.
In your chart, state A is outputing information about which substate (A1 or A2) is active. States A1 and B are outputing information about whether they are active or not. This makes sense becasue A has substates to monitor, while A1 and B do not.
Now, if you want to check whether a state is a perent or not, you can try to count the number of substates it contains by entering:
>> numel(find(state,"-isa","Stateflow.State"))
PS. If you are running an older version of MATLAB, try using single quotes instead of double quotes.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Syntax for States and Transitions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!